android-design-library

How to change color in Material Components PROGRAMMATICALLY on Android?

偶尔善良 提交于 2020-03-03 09:06:14
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

How to set time slot in Android?

。_饼干妹妹 提交于 2020-01-26 04:02:18
问题 I am new to android programming. I am trying to show a time schedule to the user. I want users can select a time from some time slot format. Is there any predefined library is there for that? I have tried some time picker dialog. It is showing time in a clock or spinner format. but I want time in the slot. I have added picture below like this Time Slot 来源: https://stackoverflow.com/questions/59521462/how-to-set-time-slot-in-android

BottomNavigation View design issue while run in tablet

走远了吗. 提交于 2020-01-16 12:00:13
问题 I am facing BottomNavigationView issue in tablet Here is my XML code <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bnvHome" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorBackground" app:layout_constraintBottom_toBottomOf="parent" app:menu="@menu/bottom_nav_menu" /> Menu XML- <item android:id="@+id/navAppointment" android:icon="@drawable/ic_appointment_tab" android:title="@string/bn_title

How do i draw these kinds custom shape?

余生长醉 提交于 2020-01-16 09:07:10
问题 I have the following design and need to make without using png file if possible. I have done this with the help of png file but i am thinking if there is any other way which is performance centric. I have done this design with the help of png file https://pasteboard.co/Is3RtJY.png How do i draw this myself or use some tool to get this done? 回答1: Use the following code to create this custom shape bg_top_corners_round.xml and save it in your drawable: <shape xmlns:android="http://schemas

How to get the current selected item position using TabLayout in Android Design Library

时光毁灭记忆、已成空白 提交于 2020-01-14 10:19:26
问题 I am using the android design library TabLayout in that how can I get the current selected item tab position. ViewPager pager = (ViewPager) view.findViewById(R.id.pager); MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager()); pager.setAdapter(adapter); tabLayout.setupWithViewPager(pager); 回答1: As of version 22.2.1 of the Support library the TabLayout has a method getSelectedTabPosition . Source 1 | Source 2 回答2: You can call ViewPager's getCurrentItem() to get the index of

Floating Action Menu implementation using Float action button from Android Design Support library [closed]

假如想象 提交于 2020-01-12 18:49:32
问题 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 4 years ago . Is there any simple implementation of Floating Action Menu using Floating Action Button from Android Design Support Library ? 回答1: I Found one here: https://github.com/chrisbanes/cheesesquare Hope it helps :) 来源: https://stackoverflow.com/questions/30523144/floating-action-menu-implementation-using-float-action

FloatingActionButton always visible

£可爱£侵袭症+ 提交于 2020-01-05 13:00:35
问题 I am getting familiar with the new support.design library and I'm facing this issue with the FloatingActionButton. I'm trying to hide it programmatically, but the button stay always visible. I have the feeling that app:layout_anchor="@id/appbar" must override the visibility of the button. JAVA: @InjectView(R.id.search_fab) FloatingActionButton search_fab; [...] search_fab.setVisibility(View.GONE); XML: <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width=

FloatingActionButton always visible

梦想与她 提交于 2020-01-05 12:59:22
问题 I am getting familiar with the new support.design library and I'm facing this issue with the FloatingActionButton. I'm trying to hide it programmatically, but the button stay always visible. I have the feeling that app:layout_anchor="@id/appbar" must override the visibility of the button. JAVA: @InjectView(R.id.search_fab) FloatingActionButton search_fab; [...] search_fab.setVisibility(View.GONE); XML: <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width=

How to fix this error? Error inflating class android.support.design.widget.NavigationView

帅比萌擦擦* 提交于 2020-01-05 07:08:59
问题 LOGCAT E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.batyaa.first_gear_automotive, PID: 2582 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.batyaa.first_gear_automotive/com.example.batyaa.first_gear_automotive.HomeActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.NavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java

How to fix this error? Error inflating class android.support.design.widget.NavigationView

前提是你 提交于 2020-01-05 07:08:12
问题 LOGCAT E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.batyaa.first_gear_automotive, PID: 2582 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.batyaa.first_gear_automotive/com.example.batyaa.first_gear_automotive.HomeActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.NavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java