Skip to content

Commit

Permalink
+ demo
Browse files Browse the repository at this point in the history
  • Loading branch information
angcyo committed Nov 5, 2024
1 parent abe49f5 commit 3fbcf15
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ class DynamicActivity : BaseActivity() {
}, 600)
}

//重新布局
find<View>(R.id.request_layout_button)?.setOnClickListener {
window.decorView.requestLayout()
val slidingTabLayout = find<DslTabLayout>(R.id.sliding_tab_layout)
slidingTabLayout.requestLayout()
}

//动态调整背景
find<View>(R.id.border_solid_button)?.setOnClickListener {
val stateTabLayout = find<DslTabLayout>(R.id.states_tab_layout)
Expand Down
21 changes: 17 additions & 4 deletions Sample/src/main/res/layout/activity_dynamic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,25 @@

</com.angcyo.tablayout.DslTabLayout>

<Button
android:id="@+id/border_solid_button"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调整背景"
android:textAllCaps="false" />
android:orientation="horizontal">

<Button
android:id="@+id/request_layout_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重新布局"
android:textAllCaps="false" />

<Button
android:id="@+id/border_solid_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调整背景"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 3fbcf15

Please sign in to comment.