android-design-library

In a snackbar action, how can I be sure it's safe to permanently delete a soft-deleted record from the database?

梦想与她 提交于 2019-12-03 02:38:45
I am using Snackbar in android and I have implemented an action so that user can undo the action (the action is clearing all the items in the listview).Removing and adding the items back to the listview has already been done and working fine. My issue is that, items are stored in sqlite database and how can I delete the items from tables? (How can I know that the user has not clicked the undo button, so that I can completely remove the data from database). This is the code inside OnOptionsItemSelcted() case R.id.action_clear: final List<Word> temp = new ArrayList<Word>(data); data.clear();

How to set support library snackbar text color to something other than android:textColor?

我怕爱的太早我们不能终老 提交于 2019-12-03 02:06:50
问题 So I've started using the new Snackbar in the Design Support Library, but I found that when you define "android:textColor" in your theme, it applies to the text color of the snackbar. This is obviously a problem if your primary text color is dark. Does anyone know a way around this or have advice for how I should color my text? EDIT January 2017: (Post-Answer) While there are some custom solutions to fix the problem below, it's probably good to provide the correct way to theme Snackbars.

How I can multiline the expanded title of CollapsingToolbarLayout?

浪尽此生 提交于 2019-12-03 01:14:19
My problem is the next. I would use relatively large texts as CollapsingToolbarLayout title so I need to show it as multiline mode. When I try to change text appearance through the setExpandedTitleTextAppearance() method it doesn't work. The code who I used is the next: <style name="ToolbarExpandedTitle"> <item name="android:textSize">48sp</item> <item name="android:shadowColor">#ffffff</item> <item name="android:textColor">@android:color/white</item> <item name="android:singleLine">false</item> <item name="android:minLines">3</item> <item name="android:lines">4</item> <item name="android

How can I get menu item in NavigationView?

試著忘記壹切 提交于 2019-12-03 01:01:36
<android.support.design.widget.NavigationView android:id="@+id/drawer_nav" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:theme="@style/Theme.AppCompat.Light.NoActionBar" app:headerLayout="@layout/drawer_header" app:menu="@menu/menu_drawer" /> I am using android.support.design.library for material design. What I want is to hide some menu items when the user is not logged-in. Now I have trouble to get the menu item in NavigationView . I have tried: MenuItem logoutItem = (MenuItem) mNavigationView.findViewById(R.id.menu_logout);

Non-Scrolling Fragment in a ViewPager inside CoordinatorLayout

…衆ロ難τιáo~ 提交于 2019-12-02 23:18:23
I am using a ViewPager in a CoordinatorLayout (from latest version of Design Library) in an Activity. Some fragments for this ViewPager have layouts such as RecyclerView or NestedScrollView, but some just cannot scroll given their small content. <android.support.design.widget.AppBarLayout android:id="@+id/tabanim_appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/MyTheme"> <android.support.v7.widget.Toolbar android:id="@+id/tabanim_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="

How to handle issues of the new bottom sheet of the support/design library?

不问归期 提交于 2019-12-02 18:31:21
Background I've used a modified version of bottom-sheet library ( here , based on this library , also wrote about it here ), in order to have a nice transition between collapsed (AKA "peeked") state and expanded state. The library had its issues, but in general I've fixed them all. The problem Recently we've found that after going back from all ad-networks screens, back to one that has a bottom sheet, the bottom sheet gets into a weird state of being expanded. I've decided that it's time to try the new bottom-sheet of the support library (shown here ), but I've found that it has a lot of basic

WebView in CoordinatorLayout with CollapsingToolbarLayout

≡放荡痞女 提交于 2019-12-02 18:10:24
I'd like to add a WebView in a CoordinatorLayout, having CollapsingToolbarLayout in AppBarLayout. The problem is that WebView shrinks in height and doesn't fill the space below the toolbar, making it not usable. I tried also to use WebView as child of NestedScrollView: initially it doesn't work (it shrinks my WebView in height), but scrolling my shrinked WebView makes it fill viewport. Here is the layout I used: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns

How to create app bar with icons using TabLayout Android Design?

旧街凉风 提交于 2019-12-02 18:07:06
I'm trying to use the new TabLayout in the android design library to create app bar with icons. public void setupTabLayout(TabLayout tabLayout) { tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); tabLayout.setupWithViewPager(mViewpager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_tabbar_library); tabLayout.getTabAt(1).setIcon(R.drawable.ic_tabbar_recents); tabLayout.getTabAt(2).setIcon(R.drawable.ic_tabbar_favorites); tabLayout.getTabAt(3).setIcon(R.drawable.ic_tabbar_notifications); tabLayout.getTabAt(4).setIcon(R.drawable.ic_tabbar_settings)

TabLayout update tab content with a custom view

会有一股神秘感。 提交于 2019-12-02 18:02:06
I'm using TabLayout of the new material design and i have a problem, i can't update tab content of a custom view once the tab is created: I can simplify my method inside my PagerAdapter with public View setTabView(int position, boolean selected) { View v = LayoutInflater.from(context).inflate(R.layout.default_tab_view, null); tv = (TextView) v.findViewById(R.id.tabTextView); if(selected) tv.setText("SELECTED"); else tv.setText("UNSELECTED"); return v; } And in activity i can simplify my code with: TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); ViewPager pager = (ViewPager)

How to set support library snackbar text color to something other than android:textColor?

瘦欲@ 提交于 2019-12-02 16:27:35
So I've started using the new Snackbar in the Design Support Library, but I found that when you define "android:textColor" in your theme, it applies to the text color of the snackbar. This is obviously a problem if your primary text color is dark. Does anyone know a way around this or have advice for how I should color my text? EDIT January 2017: (Post-Answer) While there are some custom solutions to fix the problem below, it's probably good to provide the correct way to theme Snackbars. Firstly, you probably shouldn't be defining android:textColor in your themes at all (unless you really know