Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void changeAdapter() {
View tagView = adapter.getView(this, i, adapter.getItem(i));

tagViewContainer = new TagView(getContext());
tagView.setDuplicateParentStateEnabled(true);
setDuplicateParentStateEnabled(tagView);
if (tagView.getLayoutParams() != null) {
tagViewContainer.setLayoutParams(tagView.getLayoutParams());

Expand Down Expand Up @@ -141,6 +141,14 @@ public void onClick(View v) {
}
mSelectedView.addAll(preCheckedList);
}
private void setDuplicateParentStateEnabled(View view) {
view.setDuplicateParentStateEnabled(true);
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
setDuplicateParentStateEnabled(((ViewGroup) view).getChildAt(i));
}
}
}

public void setMaxSelectCount(int count) {
if (mSelectedView.size() > count) {
Expand Down
16 changes: 16 additions & 0 deletions flowlayout/src/main/res/layout/fl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/tag_bg">

<TextView
android:id="@+id/tv_sample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/tag_bg"
android:text="Helloworld"
android:textColor="@drawable/text_color">

</TextView>
</FrameLayout>