material-components-android

selected color of MaterialToggleButton to a solid color

吃可爱长大的小学妹 提交于 2021-02-20 19:11:38
问题 Not able to make the selected color of MaterialToggleButton to a solid color, only a transparent shade of color primary is shown. I tried the below set of code and the out image is shown below. Button theme in styles <style name="ThemeButtonColorToggle" parent="AppTheme"> <item name="colorPrimary">@color/colorOrange</item> <item name="colorButtonNormal">@color/colorOrange</item> <item name="android:backgroundTint">@color/black</item> <item name="strokeColor">@color/colorOrange</item> <item

selected color of MaterialToggleButton to a solid color

こ雲淡風輕ζ 提交于 2021-02-20 19:10:46
问题 Not able to make the selected color of MaterialToggleButton to a solid color, only a transparent shade of color primary is shown. I tried the below set of code and the out image is shown below. Button theme in styles <style name="ThemeButtonColorToggle" parent="AppTheme"> <item name="colorPrimary">@color/colorOrange</item> <item name="colorButtonNormal">@color/colorOrange</item> <item name="android:backgroundTint">@color/black</item> <item name="strokeColor">@color/colorOrange</item> <item

selected color of MaterialToggleButton to a solid color

人走茶凉 提交于 2021-02-20 19:10:17
问题 Not able to make the selected color of MaterialToggleButton to a solid color, only a transparent shade of color primary is shown. I tried the below set of code and the out image is shown below. Button theme in styles <style name="ThemeButtonColorToggle" parent="AppTheme"> <item name="colorPrimary">@color/colorOrange</item> <item name="colorButtonNormal">@color/colorOrange</item> <item name="android:backgroundTint">@color/black</item> <item name="strokeColor">@color/colorOrange</item> <item

How to change toolbar back button icon in android material components

坚强是说给别人听的谎言 提交于 2021-02-19 05:11:51
问题 I would like to change the default navigate up icon (back button icon) to my custom icon. I not using a drawer, just a simple toolbar and material components Is this possible? 回答1: If you are using a Toolbar to change the icon just use: Toolbar toolbar = findViewById(R.id.xxx); toolbar.setNavigationIcon(R.drawable.xxxx4); setSupportActionBar(toolbar); If you are using the ActionBar you can use: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R

How to change toolbar back button icon in android material components

被刻印的时光 ゝ 提交于 2021-02-19 05:10:07
问题 I would like to change the default navigate up icon (back button icon) to my custom icon. I not using a drawer, just a simple toolbar and material components Is this possible? 回答1: If you are using a Toolbar to change the icon just use: Toolbar toolbar = findViewById(R.id.xxx); toolbar.setNavigationIcon(R.drawable.xxxx4); setSupportActionBar(toolbar); If you are using the ActionBar you can use: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R

Different corner radius values for a MaterialCardView

£可爱£侵袭症+ 提交于 2021-02-18 22:27:08
问题 Is is possible to have different values for each corner radius of a MaterialCardView? And if so how? I tried something like the code below but it doesn't seem to have any effect float radius = getContext().getResources().getDimension(R.dimen.default_corner_radius); ShapePathModel leftShapePathModel = new ShapePathModel(); leftShapePathModel.setTopLeftCorner(new RoundedCornerTreatment(radius)); leftShapePathModel.setTopRightCorner(new RoundedCornerTreatment(radius)); MaterialShapeDrawable bg =

Change style of the right icon error TextInputLayout

依然范特西╮ 提交于 2021-02-18 15:12:24
问题 I want to change the style of the right icon error (the image with ! sign) in a TextInputLayout but I don't find how. It is possible?. 回答1: With the Material Component Library just use the app:errorIconDrawable attribute. Something like: <com.google.android.material.textfield.TextInputLayout app:errorIconDrawable="@drawable/..." ../> 回答2: To do this in your Java class, you can do something like this: // initialize your drawable object Drawable myErrorDrawable = getResources().getDrawable(R

Change style of the right icon error TextInputLayout

别等时光非礼了梦想. 提交于 2021-02-18 15:11:19
问题 I want to change the style of the right icon error (the image with ! sign) in a TextInputLayout but I don't find how. It is possible?. 回答1: With the Material Component Library just use the app:errorIconDrawable attribute. Something like: <com.google.android.material.textfield.TextInputLayout app:errorIconDrawable="@drawable/..." ../> 回答2: To do this in your Java class, you can do something like this: // initialize your drawable object Drawable myErrorDrawable = getResources().getDrawable(R

Change style of the right icon error TextInputLayout

ぐ巨炮叔叔 提交于 2021-02-18 15:10:45
问题 I want to change the style of the right icon error (the image with ! sign) in a TextInputLayout but I don't find how. It is possible?. 回答1: With the Material Component Library just use the app:errorIconDrawable attribute. Something like: <com.google.android.material.textfield.TextInputLayout app:errorIconDrawable="@drawable/..." ../> 回答2: To do this in your Java class, you can do something like this: // initialize your drawable object Drawable myErrorDrawable = getResources().getDrawable(R

Change style of the right icon error TextInputLayout

对着背影说爱祢 提交于 2021-02-18 15:09:55
问题 I want to change the style of the right icon error (the image with ! sign) in a TextInputLayout but I don't find how. It is possible?. 回答1: With the Material Component Library just use the app:errorIconDrawable attribute. Something like: <com.google.android.material.textfield.TextInputLayout app:errorIconDrawable="@drawable/..." ../> 回答2: To do this in your Java class, you can do something like this: // initialize your drawable object Drawable myErrorDrawable = getResources().getDrawable(R