hootsuite / nachos

Material Chips for Android
Other
451 stars 87 forks source link

How to use it to view Chips? #60

Open Shahxad-Akram opened 6 years ago

Shahxad-Akram commented 6 years ago

How to use it as a chipsView layout which is uneditable and chips are clickable?

brunotoffolo commented 6 years ago

Hi @shahzadakram67,

This is more a workaround than a proper solution, but making the component disabled can do the trick. As the component overrides the styles for spans, even when disabled it does not get that "lighter" color schema and remains with the same colors and opacities as if it was enabled.

Sample code:

NachoTextView nachoTextView = findViewById(R.id.nacho_text_view);
nachoTextView.setEnabled(false);

If you would also like to remove the bottom border of the TextView when it is displayed in the app, just set the background property to @nullin your layout's XML file.

<com.hootsuite.nachos.NachoTextView
   android:id="@+id/nacho_text_view"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:background="@null" />

Cheers!

Shahxad-Akram commented 6 years ago

I tried it but then it is not clickable

guger commented 6 years ago

@shahzadakram67 Try to set android:inputType="none" or to use the new Material Design Chips.