How to use android.support.design.widget.TabLayout to create custom layout of tab?

前端 未结 1 659
深忆病人
深忆病人 2021-01-15 11:30

I found the below documentation on how to set a customView. But when I change the id in my layout to "text1" and "icon",

相关标签:
1条回答
  • 2021-01-15 12:06

    You need to use the system Resource identifiers. That is, @android:id/text1 and @android:id/icon.

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:id="@android:id/icon"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:id="@android:id/text1"
        android:gravity="center"
        android:layout_below="@android:id/icon" />
    

    If you would need to reference these IDs in your code, they would be android.R.id.text1 and android.R.id.icon.

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