android-navigation

Android Jetpack Navigation with ViewPager and TabLayout

对着背影说爱祢 提交于 2019-12-18 10:42:54
问题 For a new app i use Jetpack Navigation Library to implement proper back navigation. The first level of navigation is a navigation drawer which works fine with jetpack navigation as described in the documentation. But there is another level of navigation implemented with ViewPager and TabLayout. The fragments switched by the TabLayout contain additional linear navigation hierarchy. However, there seems to be no support for ViewPager/TabLayout in Jetpack Navigation. A FragmentPagerAdapter has

How to combine Navigation Drawer and Spinner [like in Google+ App]

两盒软妹~` 提交于 2019-12-17 18:24:31
问题 I need your advice. In Google+ App for Android, there are two elements, that I don't know how to put together. One is "Navigation Drawer" and second is "Action Bar Navigation Spinner". Do you know how these two elements put together? Thank you very much for your advice! P.S. I know, I'm lame :) (and I apologize for my English) 回答1: Add the spinner to the NavigationBar. The basic procedure to enable drop-down navigation is: 1.Create a SpinnerAdapter that provides the list of selectable items

Change Icon Of Navigation Drawer

非 Y 不嫁゛ 提交于 2019-12-17 15:29:58
问题 I am having trouble with changing my navigation drawer icon to a custom one. I've currently had to implement the standard drawer icon which has 3 horizontal lines on top, but now I want to replace this with my custom drawer icon. This is how my mDrawerToggle is at the moment: mDrawerToggle=new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.app_icon, R.string.drawer_open) { // My code }; 回答1: Here is the sample code taken from Creating a Navigation Drawer Activity.class public class

How to make bottom navigation show menu items with icon and text except center item menu show only icon? [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-17 10:33:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I want to create bottom navigation bar show menu items icon and text except center item. eg. i have attached image 回答1: Try below code: XML file: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

Appcompatv7 - v21 Navigation drawer not showing hamburger icon

喜欢而已 提交于 2019-12-17 03:34:33
问题 I am implementing the lollipop style navigation drawer with latest appcompat support library but the problem is the hamburger icon is never displayed . Only back icon is shown. This is my activity code import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.view.View; public class Home extends ActionBarActivity {

Scrollable tabs style in Android

怎甘沉沦 提交于 2019-12-14 02:02:01
问题 I'd like to implement a navigation with two layers of tabs, similar to this one: However I cannot find how to give scrollable tabs this appearance: centered title for the active tab, and the others pushed to the sides, without separator or underlining. I'm pretty sure I've seen this scrollable tabs style before, so I was wondering if it's just a setting or maybe a third party library. Could anyone help me with this ? Thank you. 回答1: Have a look at ViewPager 's PagerTitleStrip. That's what you

How to make slide animation with a fixed screen and new screen?

会有一股神秘感。 提交于 2019-12-13 03:42:49
问题 I made three xml files for the transition. enter_from_right.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration="@android:integer/config_mediumAnimTime" android:fromXDelta="0%" android:fromYDelta="0%" android:toXDelta="0%" android:toYDelta="0%" /> </set> none.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration="@android:integer

Go back to Activity without recreating (without invoking onCreate())

筅森魡賤 提交于 2019-12-12 10:49:53
问题 I would like to ask similar question to: Go back to previous screen without creating new instance However I don't want Activity A go through onCreate callback, I would like to return to previous instance in the same state. How to achieve that without calling multiple finish() ? 回答1: There's no need to finish() activities as you navigate through your application. Instead, you can maintain your Activity back-stack and still achieve your goal. Let's say you have 4 activites like so: A --> B -->

Multiple LiveData Observers After Popping Fragment

旧城冷巷雨未停 提交于 2019-12-12 10:35:38
问题 Issue Summary : Multiple LiveData Observers are being triggered in a Fragment after navigating to a new Fragment, popping the new Fragment, and returning to the original Fragment. Details : The architecture consists of MainActivity that hosts a HomeFragment as the start destination in the MainActivity's navigation graph . Within HomeFragment is a programmatically inflated PriceGraphFragment . The HomeFragment is using the navigation component to launch a new child Fragment ProfileFragment .

How to set target fragment of a dialog when using navigation components

大兔子大兔子 提交于 2019-12-12 08:31:17
问题 I'm showing a dialog inside a fragment using childFragmentManager or within an Activity using the supportFragmentManager , in the process I would like to set the target fragment, like this: val textSearchDialog = TextSearchDialogFragment.newInstance() textSearchDialog.setTargetFragment(PlaceSearchFragment@this, 0) But when running that code I get the error: java.lang.IllegalStateException: Fragment TextSearchDialogFragment{b7fce67 #0 0} declared target fragment PlaceSearchFragment{f87414 #0