2条回答 默认 最新
- Tauren2614 2017-06-09 02:51关注
修改当前Activity的主题里的 @style/Widget.Holo.TabWidget
修改tabLayout这一项
<item name="tabStripLeft">@null</item> <item name="tabStripRight">@null</item> <item name="tabStripEnabled">false</item> <item name="divider">?attr/dividerVertical</item> <item name="showDividers">middle</item> <item name="dividerPadding">8dip</item> <item name="measureWithLargestChild">true</item> <item name="tabLayout">@layout/tab_indicator_holo</item>默认的布局如下 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="?android:attr/actionBarSize" android:orientation="horizontal" style="@android:style/Widget.Holo.Tab"> <ImageView android:id="@android:id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:visibility="gone" /> <TextView android:id="@android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" style="@android:style/Widget.Holo.TabText" />
修改LinearLayout的stytle
修改其中background背景这一项
<item name="background">@drawable/tab_indicator_holo</item> <item name="layout_width">0dip</item> <item name="layout_weight">1</item> <item name="minWidth">80dip</item>默认的背景如下 <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_holo" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_holo" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_holo" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_holo" /> <!-- Pressed --> <!-- Non focused states --> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_holo" /> <item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_holo" /> <!-- Focused states --> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_holo" /> <item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_holo" />
解决 无用评论 打赏 举报
悬赏问题
- ¥15 chaquopy python 安卓
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 有没有帮写代码做实验仿真的
- ¥15 報錯:Person is not mapped,如何解決?
- ¥30 vmware exsi重置后登不上
- ¥15 易盾点选的cb参数怎么解啊
- ¥15 MATLAB运行显示错误,如何解决?
- ¥15 c++头文件不能识别CDialog
- ¥15 Excel发现不可读取的内容
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题