material-components

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 Components for the web modal drawer example using CDNs

你离开我真会死。 提交于 2020-01-02 05:36:07
问题 Examples on using Material Components for Web CDNs for front-end design are not that helpful. I found this demo of a modal drawer but it doesn't seem to use the published CSS and JavaScript CDNs. Demo : Modal drawer demo How to implement a modal drawer using Material Components' CDNs? 回答1: It is a bit difficult to get going with MDC using unpkg bundles instead of consuming individual components via webpack. The Getting Started documentation helps a bit but it can still be difficult to

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=

How to properly display DatePickerDialog using MaterialComponents?

我怕爱的太早我们不能终老 提交于 2019-12-23 19:24:16
问题 I'm using MaterialComponents for Android from material.io. I have two themes (light and dark). I want to show an DatePickerDialog. But this is the result: Here is the code how i show my dialog: private fun selectDeadline() { val dialog = DateDialog() val bundle = Bundle() bundle.putInt("themeId", themeId) dialog.arguments = bundle dialog.show(supportFragmentManager, "") } class DateDialog : DialogFragment(), DatePickerDialog.OnDateSetListener { override fun onCreateDialog(savedInstanceState:

Sass - Setting the font family with material web components

淺唱寂寞╮ 提交于 2019-12-13 01:44:55
问题 I am using material web components in my project and I would like to change the font family. I was going through their documentation and I have tried to do that by setting the variable in my sass file like this: $mdc-typography-font-family: Comfortaa, sans-serif !default; But, that didn't work, in the documentation it also says that sass mixin sets the font: mdc-typography-base How can I change the mixin to use a different font-family? 回答1: I figured this out by removing !default flag: $mdc

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

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