material-components-android

CardView with different corner radius

混江龙づ霸主 提交于 2020-02-20 08:07:03
问题 I have the following CardView and I want to set different radius for each corner in the card. Is it possible to change them by XML or programmaticaly? Thanks in advance. <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="5dp" android

Wrong button style when creating AlertDialog with androidx DialogFragment

你。 提交于 2020-02-02 03:08:09
问题 Here is my root style: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> And here is how I create dialog: override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return AlertDialog.Builder(requireActivity()) .apply { setMessage(R.string.dialog_delete_service_message) setPositiveButton( R.string.dialog_delete_service_positive_button ) { _, _ -> listener?.onConfirmed() } setNegativeButton(R.string.dialog_delete_service_negative_button, null) }.create() }

How do I reduce the padding between the text hint and text line?

不羁岁月 提交于 2020-01-30 08:51:08
问题 I have a TextInputEditText with a hint shown. I really do not like the amount of space between the hint and text line. I have tried setting the gravity to bottom but no luck. <com.google.android.material.textfield.TextInputEditText android:layout_width="400dp" android:layout_height="wrap_content" android:background="@android:color/white" android:inputType="textNoSuggestions" android:hint="@string/email_hint" android:textColorHint="@color/color_hint_grey" android:fontFamily="@font/alternate

What is alternative of android:background in MaterialComponents?

你说的曾经没有我的故事 提交于 2020-01-24 20:41:06
问题 Question: android:background is not giving effect in MaterialComponents. In my project, I was using AppCompat ( <style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar"> ) and everything was working fine. but, because of some requirement in my project, now, I've to use MaterialComponents ( <style name="DayTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> ) And because of that some UI looks bad. Problem: In AppComapt, I was using android:background="@drawable/bg_circle_btn"

Apply style to Alert Dialogs

泄露秘密 提交于 2020-01-24 20:20:08
问题 I decided to try material alert dialogs on android. The problem I am having is when I try to apply some styles. Checking the docs, I found this: <item name="materialAlertDialogTheme">@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog</item> So I decided to try this: <style name="BaseTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"> <item name="materialAlertDialogTheme">@style/Theme.App.MaterialDialogAlert</item> </style> <style name="Theme.App.MaterialDialogAlert" parent=

Android - ImageView with rounded only one corner

蹲街弑〆低调 提交于 2020-01-24 05:14:10
问题 I want to create ImageView like this (right side of the image): I have it in CardView layout so I have rounded corners of the card but I need to create rounded left bottom corner of the image alone (or with top right). I tried several options but nothing work correctly. How can I do this? Do you have some tip? 回答1: You can use this library and put your ImageView inside the Layout https://github.com/JcMinarro/RoundKornerLayouts and can set the radius for specific corners like this

I want to import design library in androidx 29 version(latest version)

我与影子孤独终老i 提交于 2020-01-24 01:57:13
问题 Below image clarify my question. I was try multiples of times to import design library in android studio lastest version 29 (android x) but library does'nt work kindly tell me the design library for androidx 29. 回答1: You can use : - implementation 'com.google.android.material:material:1.0.0' library in androidx for design. 回答2: The library androidx.design:design:1.0.0 doesn't exist . You have to use the Material Components library. Material Components for Android is a drop-in replacement for

What is alternative of AppCompat.Button.Borderless in MaterialComponents?

偶尔善良 提交于 2020-01-16 05:26:30
问题 Because of some requirement in my project, I must use MaterialComponents, so my previous UI is became messy, and I need to change it. previous Image with AppCompat: new Image with MaterialComponents: Code: <style name="ButtonBorderless" parent="Base.Widget.AppCompat.Button.Borderless"> <item name="android:minHeight">0dp</item> <item name="android:minWidth">0dp</item> <item name="android:textSize">14sp</item> </style> MainStyle: <style name="DayTheme" parent="Theme.MaterialComponents.Light

ImageView with only one rounded corner

拜拜、爱过 提交于 2020-01-14 06:21:08
问题 I'm trying to make one rounded corner of ImageView like in the picture below but with bottom right corner. Tried using background shape but it's not working at all. All images loaded by Glide. Should i use something like ViewOutlineProvider ? Is there are an efficient way to do this? Thanks! <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="2dp" android:bottomRightRadius="20dp" android:bottomLeftRadius="0dp" android:topLeftRadius="0dp" android

Persistent Bottom Sheet with rounded corners in Android crashes when used in a card view

∥☆過路亽.° 提交于 2020-01-05 04:57:22
问题 I have created a persistent bottom sheet in android with the intent of displaying a ListView containing additional information about locations. I want the sheet to have rounded corners. I got a ton of results for modal dialog but none for persistent. Is it possible or should I use the modal version? As suggested in an answer here, I tried wrapping it in a card view but the app crashes when I try to open the fragment. <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget