Background in tab widget ignore scaling

后端 未结 2 992
礼貌的吻别
礼貌的吻别 2020-12-15 14:42

I tried to use a background (480x320) for my tab content. Using a xml as drawable, I should be able to scale the image. This works fine outside the tabhost/tabactivity. If I

相关标签:
2条回答
  • 2020-12-15 15:19

    set the background to ur tabhost tag not in tabcontent layout. that is

    <TabHost android:background="@drawable/background">
    
    0 讨论(0)
  • 2020-12-15 15:35

    Try just placing this inside the RelativeLayout and not using your background drawable:

    <Drawable 
        android:src="@drawable/background_img" 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:scaleType="fitCenter" />
    

    Since elements inside the relativelayout can overlap, this oughta work, and using a Drawable in the layout independently instead of a Bitmap included as the element background_src might give you more flexibility.

    0 讨论(0)
提交回复
热议问题