material-components

MaterialDatePicker shows current date instead of needed

匆匆过客 提交于 2020-07-14 09:46:30
问题 Using MaterialDatePicker I want to show required date and give an opportunity to select another. But when a DatePicker appears it shows current date instead of specified. I plug the library: implementation 'com.google.android.material:material:1.2.0-alpha06' (or 1.1.0). Then override AppTheme in styles.xml : <style name="AppTheme" parent="Theme.MaterialComponents.Light"> And now can show DatePicker. val now = Calendar.getInstance() now[Calendar.YEAR] = 2020 now[Calendar.MONTH] = 10 now

MaterialComponents AlertDialog text color

安稳与你 提交于 2020-07-07 06:53:49
问题 Reading MaterialComponents theme alert dialog buttons and https://medium.com/@lcdsmao/material-design-custom-alert-dialog-5a9cab3ade11 I set AlertDialog buttons and text colors of new Material Theme. <!-- Base application theme. --> <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color

Material Date Picker Custom Styling

孤人 提交于 2020-07-06 16:08:32
问题 i have used range date picker from google material with this library implementation 'com.google.android.material:material:1.2.0-alpha02' this is my code MaterialDatePicker.Builder<Pair<Long, Long>> builder = MaterialDatePicker.Builder.dateRangePicker(); CalendarConstraints.Builder constraintsBuilder = new CalendarConstraints.Builder(); builder.setCalendarConstraints(constraintsBuilder.build()); MaterialDatePicker<Pair<Long,Long>> picker = builder.build(); assert getFragmentManager() != null;

How to disable past dates in MaterialDatePicker?

十年热恋 提交于 2020-07-03 10:20:55
问题 //Material Date Picker private val calendar = Calendar.getInstance() private val constraintsBuilder = CalendarConstraints.Builder().setStart(calendar.timeInMillis) private val builder = MaterialDatePicker.Builder.datePicker() private val picker = builder .setSelection(calendar.timeInMillis) .setInputMode(MaterialDatePicker.INPUT_MODE_CALENDAR) .setCalendarConstraints(constraintsBuilder.build()) .build() I am using above code to open calendar setSelection method select current date and

MaterialCardView crashes with material:1.1.0

邮差的信 提交于 2020-07-03 05:52:16
问题 I am using MaterialCardView as my cardview layout. Now, Android-studio started showing me that instead of current implementation "com.google.android.material:material:1.0.0" , I should update to 1.1.0 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/edit_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" android

MaterialCardView crashes with material:1.1.0

∥☆過路亽.° 提交于 2020-07-03 05:52:13
问题 I am using MaterialCardView as my cardview layout. Now, Android-studio started showing me that instead of current implementation "com.google.android.material:material:1.0.0" , I should update to 1.1.0 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/edit_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" android

MaterialCardView crashes with material:1.1.0

北慕城南 提交于 2020-07-03 05:51:24
问题 I am using MaterialCardView as my cardview layout. Now, Android-studio started showing me that instead of current implementation "com.google.android.material:material:1.0.0" , I should update to 1.1.0 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/edit_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" android

How to change Theme of “MaterialDatePicker” in Android?

北慕城南 提交于 2020-06-26 14:38:53
问题 I've used MaterialDatePicker for the purpose of selecting a single date & also I had achieved that task but I cannot change the theme of the header & button. MaterialDatePicker.Builder builder; MaterialDatePicker materialDatePicker; long today = MaterialDatePicker.todayInUtcMilliseconds(); CalendarConstraints.Builder con = new CalendarConstraints.Builder(); con.setValidator(DateValidatorPointForward.now()); builder.setSelection(today); builder.setCalendarConstraints(con.build());

Restrict Range in Android DatePicker Custom Dialog

时光怂恿深爱的人放手 提交于 2020-06-08 20:12:54
问题 I have a custom linear layout which has DatePicker and TimePicker widgets in it. This is used as DateTime picker. I want to restrict the DatePicker by way of setMaxDate() and setMinDate() . I have done: dp.setMaxDate(new DateTime().minusDays(1).getMillis()); dp.setMinDate(new DateTime().minusDays(30).getMillis()); The dates beyond this range are actually grayed out when the dialog appears. But I can still select a grayed date. I have stumbled upon this. But, what is the work around for a

Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView

给你一囗甜甜゛ 提交于 2020-06-08 19:02:11
问题 I'm trying to add BottomNavigationView to my layout with this library: implementation 'com.google.android.material:material:1.0.0' This is my layout: <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".home.HomeActivity"> <androidx.appcompat.widget