material-components-android

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

有些话、适合烂在心里 提交于 2019-12-05 03:46:07
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" android:visibility="visible" fab:fab_colorNormal="#DA4336" fab:fab_colorPressed="#E75043" fab:fab

customize Bounding box stroke in TextInputLayout.OutlinedBox

痴心易碎 提交于 2019-12-05 00:51:37
问题 I'm trying to change box Stroke Color of com.google.android.material.textfield.TextInputLayout while not focused but there is no attribute for that this is my TextInputLayout code <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="36dp" android:layout_marginTop="38dp" android:layout_marginEnd="36dp" android:textColorHint=

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

廉价感情. 提交于 2019-12-04 19:27:19
问题 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

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

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

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 should I import Toolbar tool in android studio?

ⅰ亾dé卋堺 提交于 2019-12-02 08:12:24
问题 I am trying to add a Toolbar to my android studio project. I found several explanations of how should I do it and they all explained these steps. In the first step, I should import android.support.v7.widget.Toolbar; but it does not succeed: The v7 characters bulbing in red and the warning message is: "Cannot resolve symbol 'v7'". I tried to replace the v7 with v4 which is included in the suggestions bar after the import android.support.____ but when I do so, the android studio claims it