material-components-android

How to remove horizontal padding from TextInputLayout?

China☆狼群 提交于 2019-12-02 07:34:17
问题 After migrating to newest version of Material Components ( 1.1.0-alpha09 ), I've noticed that TextInputLayout has some padding horizontal padding. My goal is to achieve the old style of text fields, where there is no background or outline box. So I extended one of the styles, i.e. Widget.MaterialComponents.TextInputLayout.FilledBox and set background color to transparent. <style name="Widget.MyApp.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"> <item name=

MaterialDatePicker not working on Android

本秂侑毒 提交于 2019-12-01 18:43:50
I want to change the date picker of my project to the date picker provided by the Material Components for Android, but it is not working. This is the code I've tried: MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker(); MaterialDatePicker<Long> picker = builder.build(); picker.show(getSupportFragmentManager(), picker.toString()); This is how it looked like: An this is how it should've looked like: Can anybody tell me what's missing? Thanks With the Material Components for Android you can use the new MaterialDatePicker . To work fine, in your app you have to use a

Android Date Picker Material Style

我的梦境 提交于 2019-12-01 18:14:37
问题 i have implemented the date picker on my fragment, this is the code: edittext_from.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); android.app.DatePickerDialog datePickerDialog = new android.app.DatePickerDialog(getContext(), new android.app.DatePickerDialog.OnDateSetListener() { @Override public void onDateSet

Badge on BottomNavigationView

浪子不回头ぞ 提交于 2019-12-01 15:28:08
I am trying to add a badge to the BottomNavigationView Item without using any library, however somehow the BottomNavigationView is not showing the badge (custom_view) main_view.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="

Android material chips

早过忘川 提交于 2019-11-30 17:20:07
I want to implement an autocomplete edittext with chips in my application and I want to do it in a way that it's done here: material design chips . First I would like to ask if there is some kind of widget (maybe as part of the new support library) or a solution that I can use for easy implementation. (I know that this question has been asked before but I just want to know if something changed in the meantime). Also I found this library , but I don't know how can I use it (and can I use it) for autocompletion of my sets of data... Has anyone worked with this library before and can share their

Android material chips

℡╲_俬逩灬. 提交于 2019-11-30 16:31:03
问题 I want to implement an autocomplete edittext with chips in my application and I want to do it in a way that it's done here: material design chips. First I would like to ask if there is some kind of widget (maybe as part of the new support library) or a solution that I can use for easy implementation. (I know that this question has been asked before but I just want to know if something changed in the meantime). Also I found this library, but I don't know how can I use it (and can I use it) for

How to change android button text color globally in theme

你离开我真会死。 提交于 2019-11-30 16:26:13
问题 How can I change all my buttons text color? I know I can set the background color like follows : <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> ... <item name="colorButtonNormal">@color/buttonColor</item> </style> How can I do this for the button Text? 回答1: <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:textColor">#yourcolor</item> <item name="android:buttonStyle">@style/ButtonColor</item> <item name="colorButtonNormal"

New Bottom Layout from Google

你说的曾经没有我的故事 提交于 2019-11-29 04:45:33
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? You can use the new Material Components for Android and the BottomAppBar component. Use something like: <com.google.android.material.bottomappbar.BottomAppBar android:id="@+id/bar" android:layout_gravity="bottom" app:fabCradleMargin="8dp" app

Change dialog button color

旧巷老猫 提交于 2019-11-28 10:54:58
问题 Is there any way how to change default dialog buttons colour, or do I need to do custom dialog for that? This is my dialog: private void removeItem(final int position) { /** Create dialog which ask if user is sure about delete name from list **/ AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Delete player"); builder.setIcon(R.mipmap.ic_launcher); builder.setMessage("Do you want to delete player: \"" + mNameList.get(position).getText1() + "\"?") .setCancelable

Cannot render MaterialButton with android.material:1.1.x

为君一笑 提交于 2019-11-27 13:42:58
问题 Whenever I use MaterialButton, I get the following exception in the xml preview: java.lang.IllegalArgumentException: java.lang.ClassCastException I have upgraded to android studio 3.4 and to com.google.android.material:material:1.1.0-alpha05 Version 1.0.0 works but any 1.1.x doesn't. Is this a problem with the IDE or the library? - For reference, the full stacktrace: java.lang.ClassCastException@d8dc5d1 at sun.reflect.GeneratedMethodAccessor893.invoke(Unknown Source) at sun.reflect