Created
March 25, 2021 14:33
-
-
Save jshvarts/715eb013533c59f4b0a0beb3dcdda6e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<com.google.android.material.chip.ChipGroup | |
android:id="@+id/chipGroup" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="16dp" | |
app:layout_constraintHorizontal_bias="0" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:selectionRequired="true" | |
app:flow_verticalStyle="spread" | |
app:singleSelection="true"> | |
<com.google.android.material.chip.Chip | |
android:id="@+id/chip1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:checkable="true" | |
android:text="Neither agree no disagree" | |
app:checkedIcon="@drawable/ic_favorite_selected" | |
app:chipBackgroundColor="@color/white" | |
app:chipIcon="@drawable/ic_favorite_unselected" | |
app:chipStrokeColor="@color/black" | |
app:chipStrokeWidth="1dp" | |
app:iconStartPadding="4dp" /> | |
<com.google.android.material.chip.Chip | |
android:id="@+id/chip2" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:checkable="true" | |
android:text="Two" | |
app:checkedIcon="@drawable/ic_favorite_selected" | |
app:chipBackgroundColor="#f5fcff" | |
app:chipIcon="@drawable/ic_favorite_unselected" | |
app:chipStrokeColor="#7ad7f0" | |
app:chipStrokeWidth="1dp" | |
app:iconStartPadding="4dp" /> | |
</com.google.android.material.chip.ChipGroup> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
view.findViewById<ChipGroup>(R.id.chipGroup).setOnCheckedChangeListener { group, checkedId -> | |
println("Chip checked $checkedId") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment