为什么绘制重叠在我TabView的文本 [英] Why is the drawable overlapping the text in my tabview

查看:205
本文介绍了为什么绘制重叠在我TabView的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么标签文本重叠选项卡中的绘制?有没有一种方法,以prevent呢?在绘制总是集中?什么是能够以及添加文字作为绘制的指标,如果它给这个输出点。

Why does the tab text overlap the drawable in the tab? Is there a way to prevent this? Is the drawable always centered? What's the point of being able to add text as well as a drawable to the indicator if it gives this output.

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)));

能否别人帮忙吗?我已经试过一切都很我能想到的,它看起来像这样无论是在我的手机和我的模拟器。我用之前的标签,并没有做到这一点。

Can anyone else help? I've tried everythin I can think of and it looks like this both in my phone and my emulator. I've used tabs before and it didn't do this.

推荐答案

请参考大小和定位部分:的http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html

Refer to the "Size and positioning" section in: http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html

最有可能你有尺寸是不正确的分辨率级别(LDPI,MDPI,华电国际)下的图标。这发生在我身上时,我的图标正在LDPI 30×30。我调整他们28x28,并把它们在MDPI的文档建议。

Most likely you have icons with dimensions that are under the incorrect resolution level (ldpi, mdpi, hdpi). This happened to me when my icons were 30x30 under ldpi. I resized them to 28x28 and put them under mdpi as the documentation suggests.

此外,该文件建议不要使用颜色,特别是对于未选择的选项卡为你做了。使他们灰度和使用灰/白模式使得它看起来很多吸尘器这一主题。

In addition, the documentation recommends against using colors, especially for unselected tabs as you have done. Making them grayscale and using the gray/white paradigm makes it look a lot cleaner with that theme.

这篇关于为什么绘制重叠在我TabView的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆