当前位置:编程学习 > wap >>

急急急,为什么资源图片不能填满tab?

 
上面那个橙色的图片大小是150*60  应该可以铺满这个tab才对,为什么是这样的效果?被缩小了 --------------------编程问答-------------------- 是有padding吧,或者margin --------------------编程问答--------------------
引用 1 楼 ultrapro 的回复:
是有padding吧,或者margin
没有 
<?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" 
        > 
        <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" 
             /> 
     
    </LinearLayout> 
</TabHost>
--------------------编程问答-------------------- 代码如下
 spec = tabHost.newTabSpec("forecast").setIndicator(res.getString(R.string.str_forecast), 
         res.getDrawable(R.drawable.yugao)) 
                      .setContent(intent); 
        tabHost.addTab(spec); 
--------------------编程问答-------------------- tabhost控件就是这样的,上面图片,下面文字。

 spec = tabHost.newTabSpec("forecast").setIndicator(res.getString(R.string.str_forecast), 
                res.getDrawable(R.drawable.yugao)) 

你可以考虑把图片改成背景的设置。 --------------------编程问答-------------------- http://blog.csdn.net/ch_984326013/article/details/6602602

http://blog.csdn.net/ch_984326013/article/details/6605537 --------------------编程问答-------------------- 因为你使用的是系统控件,而系统控件将中间那个放图片的控件设死了,所以不能填满整个TAB区域 --------------------编程问答-------------------- 图片 设成背景 就行
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,