2010-10-20 30 views
0

爲什麼標籤文本不重複的標籤中的繪製?有沒有辦法來防止這種情況?繪圖總是居中?如果能夠添加文本以及指示器給出該輸出,那麼它有什麼意義?爲什麼在我的TabView的重疊繪製文本

alt text

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:orientation="vertical"   
     android:layout_width="fill_parent"   
     android:layout_height="fill_parent"   
     android:padding="5dp"> 
     <TabWidget    
      android:id="@android:id/tabs"    
      android:layout_width="fill_parent"    
      android:layout_height="wrap_content"/>   
     <FrameLayout    
      android:id="@android:id/tabcontent"    
      android:layout_width="fill_parent"    
      android:layout_height="fill_parent"    
      android:padding="5dp" /> 
</LinearLayout> 
</TabHost> 

的Java


host.addTab(host.newTabSpec("_tab2") 
       .setIndicator("Authors",res.getDrawable(android.R.drawable.ic_menu_mapmode)) 
       .setContent(new Intent(this, AuthorList.class))); 

燦別人的幫助?我已經試過了我能想到的所有東西,它看起來像我的手機和我的模擬器。我以前使用過標籤,但沒有這樣做。

在我用這個每個實例

回答

0

,它爲我工作,但你看我可以幫助的唯一的事情,就是儘量加大了填充只是一點點,看看它是否工作有更多更好的填充這個詞

+0

添加填充到什麼呢? – Falmarri 2010-10-20 21:50:00

+0

你使用框架佈局的是什麼? – Samuel 2010-10-25 16:47:26

+0

這就是如何定義tabhost佈局。該FrameLayout裏就是Android的把標籤 – Falmarri 2010-11-02 01:00:56

1

請參閱「大小和定位」部分:http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html

很可能是因爲其尺寸是不正確的分辨率級別(LDPI,MDPI,華電國際)下的圖標。當我的圖標在ldpi下爲30x30時,這發生在我身上。我將它們的大小調整爲28x28,並按照文檔中的說明將它們置於mdpi之下。

此外,該文件建議不要使用顏色,特別是對於未選擇的選項卡爲你做了。使他們灰度和使用灰色/白色的範例,使得它看起來更清晰的主題。

+1

我貼顯然不是產值的內容...我只是使用了默認可繪製。重點是它沒有正確定位圖標和文本。使用較小的drawables會有所幫助,但它不能解決問題,它只會使drawable足夠小,不會重疊文本。無論如何,這個問題現在已經有7個月了,而且這個項目已經完成了很久。我從來沒有找到一個滿意的解決方案,只是它是一個錯誤。 – Falmarri 2011-05-06 00:52:13