2012-04-18 174 views
0

我不能在我的android應用程序中添加一個自定義按鈕。當我在控制檯中運行它時,它會一直在Logcat中顯示以下錯誤,並強制關閉。是否有人可以幫助解決此問題?在android中的自定義按鈕

04-18 10:59:00.785:E/AndroidRuntime(368):java.lang.RuntimeException:無法啓動活動ComponentInfo {com.bsm.rssreader/com.bsm.rssreader.headlines}:android.view .InflateException:二進制XML文件行#75:錯誤充氣類

這裏是我的XML文件,

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     > 
     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:layout_weight="14.08" 
      android:scaleType="fitXY" 
      android:src="@drawable/logo" /> 

<HorizontalScrollView 
     android:id="@+id/horizontalScrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:fillViewport="true" 
     android:scrollbars="none" > 


     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 

</HorizontalScrollView> 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="246dp" 
      android:layout_weight="26.53" > 

      <ListView 
     android:id="@+id/listView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:divider="#b5b5b5" 
     android:dividerHeight="1dp" 
     android:listSelector="@drawable/list_selector" /> 
     </FrameLayout> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="30dp" > 

      <ImageView 
       android:id="@+id/imageView2" 
       android:layout_width="match_parent" 
       android:layout_height="30dp" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentTop="true" 
       android:scaleType="fitXY" 
       android:src="@drawable/foot" /> 


      <Button 
       android:id="@+id/about" 
       android:layout_width="50dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true" 
       android:background="@drawable/aboutbutton" /> 




      <Button 
       android:id="@+id/button1" 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="50dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:layout_toLeftOf="@+id/about" 
       android:background="@drawable/ratebtn" /> 

     </RelativeLayout> 

    </LinearLayout> 

</TabHost> 
+0

http://pastebin.com/FgnVBBwj檢查這個完整的logcat。 – 2012-04-18 05:36:15

+0

發佈您的xml文件... – 5hssba 2012-04-18 05:37:39

+0

僅當我添加自定義按鈕時纔會出現此問題。 – 2012-04-18 05:43:08

回答

0

你檢查從logcat的這條線?

34行:10月4日至18日:59:00.785:E/AndroidRuntime(368):java.lang.OutOfMemoryError:所致位圖的大小超過VM預算

也許你有記憶的問題由於button1的圖像而泄漏。

This postthis post可以幫助

+0

在評論中寫下這樣的東西不是在回答.. – Bhavin 2012-04-18 05:36:14

+0

對不起,但我不能。 – gutiory 2012-04-18 05:39:14

+0

然後不要,否則some1會給你downVote,因爲它不是一個答案... – Bhavin 2012-04-18 05:40:30