2010-11-03 32 views
0

我有一个标签布局,可绘制资源作为标签图像。 在横向模式下一切都很好。但在纵向模式下,图像没有一些标签页边距。我如何改变图像比例或如何设置一些边缘图像?我不想使用固定大小,不要认为这是正确的方式。如何更改标签图像比例尺

这里是我的布局

<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" 
       > 
      <ListView 
        android:id="@+id/list" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        /> 
     </FrameLayout> 


<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:drawable="@drawable/logo" android:state_selected="true" /> 
    <item android:drawable="@drawable/logo_disabled" /> 
</selector> 

这里是标签创建

Drawable d = res.getDrawable(R.drawable.logos); 
    spec = tabHost.newTabSpec(1).setIndicator("", res.getDrawable(R.drawable.logos)).setContent(intent); 
    tabHost.addTab(spec); 

回答

3

解决我的问题我自己

//set icons padding 
    for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++){ 
     tabHost.getTabWidget().getChildAt(i).setPadding(10,10,10,10); 
    }