android-design-library

Change font of the floating label EditText and TextInputLayout

怎甘沉沦 提交于 2019-11-27 13:10:05
Someone tried to change the font of the floating label? I changed the source of EditText but the font of the floating label did not change, I am very grateful to those who help me Code: <android.support.design.widget.TextInputLayout android:id="@+id/tilTextoDescricao" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/tilValorUnidade" android:layout_marginTop="10dp"> <EditText android:id="@+id/etTextoDescricao" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:hint="Descrição"

Android support v23.1.0 update breaks NavigationView get/find header

拟墨画扇 提交于 2019-11-27 12:40:40
I have been using the v23.0.1 support library until now with no problems. Now when I switch to the new v23.1.0 library I am getting a null pointer on widgets in the drawer layout. mNavigationView = (NavigationView) findViewById(R.id.navigation_view); TextView username = (TextView) mNavigationView.findViewById(R.id.username_textView); // ^^^^^^^^ is now null when using new library // which causes the following to fail username.setText(mUser.getName()); activity layout <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res

New Android Design Library bug with AppBarLayout and Toolbar

流过昼夜 提交于 2019-11-27 11:55:34
I am using the new Android Design Library based on this example chrisbanes/cheesesquare in github and here I have run the example and I am having problems with Toolbar inside CheeseDetailActivity. The toolbar isnt shown as it should. Have a look at the images below: At first image you can see the toolbar isn't shown correctly. At the second image you can see that the toolbar is shown correctly but the notification bar is white. This happens because I removed from actiivty_detail.xml android:fitsSystemWindows="true" from android.support.design.widget.CoordinatorLayout I think that

Disable icon colorStateList in NavigationView

核能气质少年 提交于 2019-11-27 11:28:36
In my app today I have icons which doesn't just have a single color, but in some cases two colors depending on the data state in my app. This means I can't use the default tinting behavior in NavigationView . It looks like with the new NavigationView , unless I specify a ColorStateList for my icons used in the list, a default ColorStateList will be made for me which uses my colorPrimary etc defined in my theme. Is there no way for me to force NavigationView to stop tinting my icons? Is there no way for me to force NavigationView to stop tinting my icons? There sure is. You can do so

Set initially selected item index/id in BottomNavigationView

邮差的信 提交于 2019-11-27 11:09:56
问题 I have implemented BottomNavigationView and have no idea how to set selection index or MenuItem id (in my case, middle item should be selected by default). I'm afraid there's no such possibility for now as far as it's too raw yet, but anyways any help will be appreciated. Thanks! 回答1: Set the selected menu item ID using setSelectedItemId: bottomNavigationView.setSelectedItemId(R.id.item_id); This method started being available from Android Support Library 25.3.0. 回答2: The only solution that

TabLayout tab selection

扶醉桌前 提交于 2019-11-27 10:28:30
How to select tab in TabLayout programmatically? TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); If you know the index of the tab you want to select, you can do it like so: TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); TabLayout.Tab tab = tabLayout.getTabAt(someIndex); tab.select(); This technique works even if you're using the TabLayout by itself without a ViewPager (which is atypical, and probably bad practice, but I've seen it done). This is how I solved it: void selectPage(int pageIndex){ tabLayout.setScrollPosition(pageIndex

Android NestedScrollView has wrong size after app:layout_behavior

谁说我不能喝 提交于 2019-11-27 10:22:22
问题 Since Google has published the design support library for android, there are many nice things that can be done without implementing custom code. While i've tested the custom views in this lib, i have found a worse thing, and i didn't know if this is a bug or not. I have found the cheesesquare project on github. In the activity_detail.xml(layout file) there are 3 CardViews inside the NestedScrollView. If you delete 2 of them, you can see that the NestedScrollView doesn't have the full size of

Android Design Library - Floating Action Button Padding/Margin Issues

天涯浪子 提交于 2019-11-27 10:20:57
I'm using the new FloatingActionButton from the Google Design Library and I am getting some strange padding/margin problems. This image (with developer layout options on) is from API 22. And from API 17. This is the XML <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_gravity="bottom|right" android:layout_marginLeft="16dp" android:layout_marginRight="20dp" android:layout_marginTop="-32dp" android:src="@drawable/ic_action_add" app:fabSize="normal"

Dynamically add and remove tabs in TabLayout(material design) android

梦想与她 提交于 2019-11-27 10:17:00
问题 I have a TabLayout and inside that I have ViewPager. I need to dynamically add and remove tab in tablayout(material design). I can able to add the tabs dynamically but while removing the tab, tab is removing correctly. But viewpager last item is deleted. So tab is not showing specific fragment. FYI i have used FragmentPagerAdapter. I have followed this tutorial to implement this https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library public class TabFragment

TabLayout tab style

一个人想着一个人 提交于 2019-11-27 10:14:39
问题 I use new TabLayout from com.android.support:design library. I want to change background of the selected/unselected tabs. I look at sources and found only tabBackground attribute that change all tabs colour and does not control selected tab colour. How can I control selected/unselected tab background? 回答1: Define: <style name="AppTabLayout" parent="Widget.Design.TabLayout"> <item name="tabMaxWidth">@dimen/tab_max_width</item> <item name="tabIndicatorColor">?attr/colorAccent</item> <item name=