material-components

Material design Spinner using TextInputLayout.OutlinedBox styling

故事扮演 提交于 2019-12-04 10:58:36
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.widget.TextInputLayout> I am trying to add a dropdown box Spinner under my TextInputEditText, and would

Badge on BottomNavigationView

微笑、不失礼 提交于 2019-12-04 03:07:58
问题 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

how to set materialButton icon to the center

女生的网名这么多〃 提交于 2019-12-04 02:10:42
I am using supportLibrary = "28.0.0-beta01" version. Here is my code in .xml file: <android.support.design.button.MaterialButton android:layout_width="match_parent" android:layout_height="wrap_content" app:icon="@drawable/ic_my_orders" app:iconGravity="textStart" android:gravity="center"/> To my code icon of the drawable locating left side of the button. I want to set button to the center. I want to achieve this result Edit I don't need to any custom views or hard coded things. If this is a bug (app:iconGravity), I will wait next release. EDIT The bug fixed in the version 28.0.0-rc01 ,just

TextInputLayout suffix/prefix

霸气de小男生 提交于 2019-12-04 00:46:29
问题 I want to add suffix to TextInputLayout. An example is taken from the material.io Are there any standard solutions? 回答1: There are no standard solutions, I did it with textView right to textInputLayout and editText padding. <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="4dp" android:gravity="bottom"> <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android

Style SnackBar in theme app

烈酒焚心 提交于 2019-12-03 23:33:36
问题 I need help. How can I change the design of the text in snackbar in styles app? The change in the code does not interest me. I found the following code. But it is not working for me. Why is that? My theme is derived from @style/Theme.AppCompat.Light.DarkActionBar". I would be very grateful for the help. <style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance"> <item name="android:textSize">10sp</item> <item name="android:textColor">#FEFEFE</item> </style> <style

How to center icon in a MaterialButton which has no text?

懵懂的女人 提交于 2019-12-03 12:11:31
I'm using the latest version of the com.google.android.material:material library (i.e. 1.1.0-alpha03 ) and I have a MaterialButton defined with an icon and no text as follows: I was hoping the MaterialButton would be rendered as a square with the icon centred within it but instead the MaterialButton is rendered as follows: If I change the iconGravity value to "textStart" the MaterialButton is rendered as follows: This is a slight improvement to the positioning of the icon but the icon is still a little off centre. If I change the insetLeft , insetRight , insetTop and insetBottom values to 0dp

Material Components for the Web vs Angular Material 2 [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 01:02:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 months ago . Recently, the successor to MDL (Material Design Lite) project was launched as Material Components for the Web. One of its goals is "Seamless integration with other JS frameworks and libraries". There is another project Angular Material2 which provides material design components specifically for Angular (v2+).

MaterialDatePicker get selected dates

。_饼干妹妹 提交于 2019-12-02 12:28:06
问题 I'm calling a MaterialDatePicker like this in Android: MaterialDatePicker.Builder<Pair<Long, Long>> builder = MaterialDatePicker.Builder.dateRangePicker(); CalendarConstraints.Builder constraintsBuilder = new CalendarConstraints.Builder(); builder.setCalendarConstraints(constraintsBuilder.build()); int dialogTheme = resolveOrThrow(getContext(), R.attr.materialCalendarTheme); builder.setTheme(dialogTheme); MaterialDatePicker<?> picker = builder.build(); picker.show(getFragmentManager(), picker

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=

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