Closed fumayer closed 1 month ago
可以通过属性tab_text_view_id
和tab_icon_view_id
指定对应控件的id, 库就能自动处理了:
<!--指定文本控件的id, 所有文本属性改变, 将会发生在这个控件上, 如果指定的控件不存在, 控件会降权至[ItemView]-->
<attr name="tab_text_view_id" format="reference" />
<!--指定图标控件的id, 同上-->
<attr name="tab_icon_view_id" format="reference" />
可是我看xml中只能指定一个id,我怎么让四个都实现 那种效果呢, 是需要在代码中指定id吗?
4个图片控件用同一个id, 4个文本控件用同一个id. 即可.
我用的databinding,xml中没法共用一个id,我再想想其他办法吧,多谢啦
我用的databinding,xml中没法共用一个id,我再想想其他办法吧,多谢啦
官方的弃子, 为何还要用?
啊?已经不推荐了吗,我都不知道
<com.angcyo.tablayout.DslTabLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/tab_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/white" android:minHeight="50dp" app:tab_deselect_color="@color/text" app:tab_indicator_color="@color/colorAccent" app:tab_indicator_drawable="@drawable/indicator_bottom_line" app:tab_indicator_height="3dp" app:tab_item_is_equ_width="true" app:tab_select_color="@color/colorAccent" tools:tab_default_index="1"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical">
就是这种,我用了LinearLayout,图片用了selector, 显示效果就是选中后图片会切换,但是文字颜色不会变