Reputation: 1
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:thumbTint="@color/red"/>
I want to add red thumb tint color to my switch in java
Below is my code in java
Switch switch_btn=new Switch(edit_turf.this);
switch_btn.setOnClickListener(edit_turf.this)
switch_btn.setId(i);
relativeLayout.addView(switch_btn);
Upvotes: 0
Views: 399
Reputation: 364770
Programmatically you can use:
switch.setThumbTintList(AppCompatResources.getColorStateList(this,R.color.xxxx));
Upvotes: 1