material-components-android

How to change hint padding for TextInputLayout when using the new prefixText?

本秂侑毒 提交于 2020-01-04 09:37:34
问题 I have tried implementing TextInputLayout with the new prefixText , using com.google.android.material:material:1.2.0-alpha02 . This is a very cool feature, but when I add a prefix text the hint label floats up and aligns after the prefix. This does not look good, especially if you have more input fields on the same page without prefix, the floating labels does not align. Relevant parts of my layout code: <LinearLayout android:id="@+id/login_input_fields" android:layout_width="match_parent"

BottomNavigationView with FloatingActionButton inside CoordinatorLayout dont match position

别来无恙 提交于 2020-01-03 21:12:51
问题 I want to hide my bottom bar on scroll but a FAB should stay on the screen. If I put the FAB on top of BottomNavigationView using anchors but it appears behind it. If I put layout_insetEdge="bottom" to the BottomNavigationView then it works but make my tests fail (https://issuetracker.google.com/issues/70162122) so I cannot use that at the moment. Layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res

Material design Spinner using TextInputLayout.OutlinedBox styling

狂风中的少年 提交于 2020-01-01 14:23:02
问题 I am currently using Material Design TextInputLayout OutlinedBox as shown below: <android.support.design.widget.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.TextInputEditText android:id="@+id/myEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Title" android:inputType="text"/> </android.support.design

Change Chip Widget style programmatically not working - Android

依然范特西╮ 提交于 2019-12-29 08:31:53
问题 I'm doing a list with Chips. I want this chips can be selected, so, taking a look to https://material.io/develop/android/components/chip/ I see I can have a "Choice Chip". As I need to create and add dynamically I have to configure with specific colors, color ripplem, ... So what I have to configure it is: val chip = Chip(context, null, R.style.CustomChipChoice) chip.isClickable = true chip.isCheckable = true chip.isCheckedIconVisible=false chip.height = ScreenUtils.dpToPx(40) chip

colorControlActivated for TextInputLayout doesn't work

。_饼干妹妹 提交于 2019-12-24 12:34:13
问题 This is my main style for the application <style name="Theme.RoundRobin" parent="Theme.MaterialComponents.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorSecondaryVariant</item> <item name="colorAccent">@color/colorPrimaryVariant</item> <item name="colorControlActivated">@color/colorControlActivated</item> <item name="colorControlNormal">@color/colorControlNormal</item> <item name=

Using latest material outlined buttons with alertdialog

假如想象 提交于 2019-12-23 17:54:37
问题 I want to use new material outlined buttons with default alert dialog. I have created style in style.xml as below <style name="OutlinedButton" parent="Widget.MaterialComponents.Button.TextButton"> <item name="strokeColor">@color/colorAccent</item> <item name="strokeWidth">2dp</item> </style> <style name="MaterialDialogStyle" parent="Theme.MaterialComponents.Dialog.Alert"> <item name="android:textColorPrimary">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item> <item

Error inflating class com.google.android.material.textfield.TextInputLayout

梦想的初衷 提交于 2019-12-22 09:44:56
问题 This is my app theme: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> I got an inflate error caused by a not using a desired theme. In the Manifest I didn't overwrite the theme for the activity that I got this error, so the AppTheme definded in styles.xml is used. Error: android.view.InflateException: Binary XML file line #122: Binary XML file line #122: Error inflating class com.google.android.material.textfield.TextInputLayout Caused by: android.view

Is any difference between a MaterialButton and a simple Button?

≯℡__Kan透↙ 提交于 2019-12-18 09:03:33
问题 If I set Theme.MaterialComponents.Light as my main theme, will be any difference between these two buttons if I use them in an xml layout? <Button /> <com.google.android.material.button.MaterialButton /> As I saw they behave both as MaterialButtons. If I want to get the behavior of the old plain button, I have to use: <androidx.appcompat.widget.AppCompatButton /> Thanks in advance! 回答1: If you are using a Material Theme there is no difference between <Button /> and <com.google.android

New Bottom Layout from Google

心已入冬 提交于 2019-12-18 04:17:28
问题 First of all, I am sorry to ask a question like this but after I downloaded latest Google IO app, I am just loving the bottom Layout as shown in the following screenshot Being new to android development, I have no clue where to start, Any idea how to achieve this bottom Layout with circle star in XML? Does anyone know what this design is called? 回答1: You can use the new Material Components for Android and the BottomAppBar component. Use something like: <com.google.android.material

How to add cardview in layout xml in AndroidX

旧街凉风 提交于 2019-12-17 22:57:44
问题 How to add cardview in layout xml in AndroidX After upgraded to AndroidX <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp"> gives a error The following classes could not be found: - android.support.v7.widget.CardView (Fix Build Path, Edit XML, Create Class) dependencies { implementation 'androidx