Why is the drawable overlapping the text in my tabview
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 t开发者_如何学Gohe 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.
Refer to the "Size and positioning" section in: http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html
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.
in each instance that I've used this, Its worked for me, but for you the only thing I see that may help, is try upping the padding just a tiny bit, check out if it works better with more padding to the word
精彩评论