material-components-android

Material TextInputLayout styles are not working when run on real device app crashes

空扰寡人 提交于 2019-12-14 04:14:33
问题 I have the problem with material components style . When adding below style into TextInputLayout the app crashes but in android studio preview it shows. style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox" Activity code--- <com.google.android.material.textfield.TextInputLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="ORDER`enter code here` NO" style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox" > <com.google.android

Android - Change color of icon and title of each tab bottom navigation

亡梦爱人 提交于 2019-12-13 01:18:51
问题 I'm trying to make a bottom navigation a bit tricky. Indeed I want this kind of bottom navigation : Each tab has a different color when it is selected. For example measure will be in red when selected (icon and title) and profile will be green when selected... So I tried to use a selector per item (in my menu) But the color is not applied. The icon change successfully (I tried to put a completely different icon when an item is selected) but not the color of the title of the tab. I tried to

How to set a gradient background to a Material Button?

帅比萌擦擦* 提交于 2019-12-12 14:32:21
问题 I'm currently using this code but the background is not changing.It is still showing accent-color as background. <com.google.android.material.button.MaterialButton android:id="@+id/materialButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello" app:cornerRadius="32dp" android:background="@drawable/gradiant_blue"/> gradiant_blue.xml <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle=

What replaced appcompat-v7 in AndroidX

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 07:48:40
问题 After migrating a couple of my older projects over to AndroidX it as though three of my dependencies are deprecated: implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' I haven't been able to find a replacement for these dependencies. Does AndroidX have an equivalent for these dependencies? 回答1: Use in the order: implementation 'androidx.appcompat:appcompat:1.0.2' implementation

Android: MaterialButton override textColor in Style

放肆的年华 提交于 2019-12-11 06:55:42
问题 I want to define an alternative Button Style that uses my secondaryColor as background and the ?colorOnSecondary respectively for the text. But I'm struggling to get the textColor defined in a style. The MaterialButton is using a (private) selector-drawable for the textColor which uses ?colorOnPrimary . So this is cumbersome to override. Is there another way to set the color without the selectorDrawable? 回答1: If you want to override the colors only for the buttons, you can use the

How to style an app migrating to MaterialComponents, AndroidX and AppCompat

让人想犯罪 __ 提交于 2019-12-10 18:17:49
问题 I want to migrate to: androidx.appcompat:appcompat com.google.android.material:material And forget about support library dependencies, but I have some questions: Which style should I use for ProgressBar in order to maintain compatibility? v21: Widget.ProgressBar.Horizontal Support Library: Widget.AppCompat.ProgressBar When should I use compat styles vs materialcomponents styles? Like @style/TextAppearance.MaterialComponents.Body1 or TextAppearance.AppCompat.Title ? Im still confused about

how to put a button in an editText [closed]

老子叫甜甜 提交于 2019-12-10 11:48:33
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 months ago . I am making a chat application and I wanted to put a button in an editText to enable the sending of Media files. I don't know how to go about it. Tried to make the vector asset in the editText clickable but it is not going 回答1: You can use the official TextInputLayout component.

Can't use android:background with button from the new material components

天大地大妈咪最大 提交于 2019-12-08 17:40:23
问题 I'm using the new material components com.google.android.material:material with android x but I can't set a custom background to the button. I know that I can use app:backgroundTint to change the color but the default background has some padding that I want to get rid of, and the old way of using android:background to set my own background but this is no longer working. I looked at the docs but can't find any mention to this change. 回答1: The documentation for the MaterialButton class says: Do

How to set Floating Action Button image to fill the button?

孤街浪徒 提交于 2019-12-06 21:59:38
问题 Usually icons are set for floating action buttons, but I need to set an image, so I can make a circular image. I added it to the project (using Android Studio-> New -> Image Asset), but the image didn't fill the entire button: My xml: <com.github.clans.fab.FloatingActionMenu android:id="@+id/run_menu" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:paddingBottom="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"

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

笑着哭i 提交于 2019-12-06 06:32:36
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.InflateException: Binary XML file line #122: Error inflating class com.google.android.material.textfield