2013-01-14 186 views
0

我遇到了與Android佈局有關的Android應用程序問題。附加圖片,你會看到「警報」按鈕伸出,看起來不像其他按鈕。我用一個已知好的圖像替換了圖像,但問題仍然存在。Android佈局或按鈕

screenshot

有人建議,這是因爲它是tabhost佈局,但所有被推薦的更改都沒有奏效。到目前爲止,我已經嘗試將屬性從android:height和width改爲「wrap_content」,「fill_parent」和「match_parent」。比賽造成了另一個奇怪的空白空間被糾正,但這個按鈕是我最後一個明顯的挑戰。

這裏是佈局代碼,你能告訴我什麼是問題嗎?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" > 

<Button 
    android:id="@+id/btnSearch" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/job_tab_bar_search" 
    android:focusable="false" 
    android:freezesText="false" 
    android:imeOptions="actionNext" 
    android:longClickable="false" 
    android:paddingLeft="17dp" 
    android:text="Search" 
    android:textColor="@color/color_text_default" 
    android:textSize="12dp" 
    android:visibility="visible" /> 

<Button 
    android:id="@+id/btnHistory" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/job_tab_bar_history" 
    android:paddingLeft="25dp" 
    android:text="History" 
    android:textColor="@color/color_text_default" 
    android:textSize="12dp" /> 

<Button 
    android:id="@+id/btnFavorites" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/job_tab_bar_favorites" 
    android:paddingLeft="30dp" 
    android:text="Favorites" 
    android:textColor="@color/color_text_default" 
    android:textSize="12dp" /> 

<Button 
    android:id="@+id/btnAlerts" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:background="@drawable/job_tab_bar_alerts" 
    android:paddingLeft="12dp" 
    android:text="Alerts" 
    android:textColor="@color/color_text_default" 
    android:textSize="12dp" /> 

</LinearLayout> 

<?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" > 

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.32" > 
    </FrameLayout> 
    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    </TabWidget> 
</LinearLayout> 
</TabHost> 

回答

0

你會認爲有人會回答,最後它很愚蠢。

的答案是:

Tabhost使用tabactivity將通過菜單項顯示背景,如果他們重新調整大小。向模式添加顏色編碼(html符號)顏色,然後使用android:border-background構造調用該顏色。