代码之家  ›  专栏  ›  技术社区  ›  Falmarri

为什么drawable与我的tabview中的文本重叠

  •  0
  • Falmarri  · 技术社区  · 14 年前

    为什么选项卡文本与选项卡中的可绘制文本重叠?有没有办法防止这种情况发生?抽屉总是居中的吗?如果指示器给出了这个输出,那么能够向指示器添加文本和绘图工具的意义何在。

    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>
    

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

    其他人能帮忙吗?我已经尝试了所有我能想到的,它看起来像这样在我的手机和我的模拟器。我以前用过标签,但它没有这样做。

    2 回复  |  直到 14 年前
        1
  •  1
  •   Raj Nigam    13 年前

    请参阅中的“尺寸和定位”部分: http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html

    很可能你的图标的尺寸低于不正确的分辨率级别(ldpi、mdpi、hdpi)。当我的图标在ldpi下是30x30的时候,我就遇到了这种情况。我将它们的大小调整为28x28,并将它们放在mdpi下,如文档所示。

    此外,文档还建议不要使用颜色,尤其是在未选定的选项卡上。将它们设为灰度级并使用灰/白范例可以使主题看起来更干净。

        2
  •  0
  •   Samuel    14 年前

    在我使用过的每一个例子中,它对我都有效,但对你来说,我看到的唯一可能有帮助的事情是,试着稍微增加一点填充,看看它是否能更好地填充单词