Is it possible to have Persistent Bottom Sheet as a Fragment?Strange out of memory issue while loading an image to a Bitmap objectFling gesture detection on grid layoutfindViewById in FragmentViewPager and fragments — what's the right way to store fragment's state?Why fragments, and when to use fragments instead of activities?Understanding Fragment's setRetainInstance(boolean)Dilemma: when to use Fragments vs Activities:You need to use a Theme.AppCompat theme (or descendant) with this activityPersistent bottom sheet with recycler viewHow to add persistent bottom sheet inside a fragment in Android

What do you call someone who asks many questions?

I'm flying to France today and my passport expires in less than 2 months

Why is the 'in' operator throwing an error with a string literal instead of logging false?

What's the point of deactivating Num Lock on login screens?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Stopping power of mountain vs road bike

How could indestructible materials be used in power generation?

Blender 2.8 I can't see vertices, edges or faces in edit mode

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Twin primes whose sum is a cube

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Watching something be written to a file live with tail

Etiquette around loan refinance - decision is going to cost first broker a lot of money

Took a trip to a parallel universe, need help deciphering

UK: Is there precedent for the governments e-petition site changing the direction of a government decision?

Why doesn't H₄O²⁺ exist?

In a Spin are Both Wings Stalled?

Emailing HOD to enhance faculty application

1960's book about a plague that kills all white people

Do I have a twin with permutated remainders?

Why is Collection not simply treated as Collection<?>

Will google still index a page if I use a $_SESSION variable?

Why do I get two different answers for this counting problem?



Is it possible to have Persistent Bottom Sheet as a Fragment?


Strange out of memory issue while loading an image to a Bitmap objectFling gesture detection on grid layoutfindViewById in FragmentViewPager and fragments — what's the right way to store fragment's state?Why fragments, and when to use fragments instead of activities?Understanding Fragment's setRetainInstance(boolean)Dilemma: when to use Fragments vs Activities:You need to use a Theme.AppCompat theme (or descendant) with this activityPersistent bottom sheet with recycler viewHow to add persistent bottom sheet inside a fragment in Android






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I want to make Persistent Bottom Sheet as a Fragment inside a Fragment but can't find anywhere how to achieve it. Everywhere Persistent Bottom Sheet is added as a layout inside activity/fragment but is it possible to make Persistent Bottom Sheet as a Fragment so that I can reuse that view some where else?










share|improve this question

















  • 2





    Show us the code to see if we can help you somehow

    – miquelarranz
    Oct 4 '18 at 8:51

















0















I want to make Persistent Bottom Sheet as a Fragment inside a Fragment but can't find anywhere how to achieve it. Everywhere Persistent Bottom Sheet is added as a layout inside activity/fragment but is it possible to make Persistent Bottom Sheet as a Fragment so that I can reuse that view some where else?










share|improve this question

















  • 2





    Show us the code to see if we can help you somehow

    – miquelarranz
    Oct 4 '18 at 8:51













0












0








0








I want to make Persistent Bottom Sheet as a Fragment inside a Fragment but can't find anywhere how to achieve it. Everywhere Persistent Bottom Sheet is added as a layout inside activity/fragment but is it possible to make Persistent Bottom Sheet as a Fragment so that I can reuse that view some where else?










share|improve this question














I want to make Persistent Bottom Sheet as a Fragment inside a Fragment but can't find anywhere how to achieve it. Everywhere Persistent Bottom Sheet is added as a layout inside activity/fragment but is it possible to make Persistent Bottom Sheet as a Fragment so that I can reuse that view some where else?







android android-fragments android-design-library bottom-sheet






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 4 '18 at 7:18









Nitin4AndroidNitin4Android

4291922




4291922







  • 2





    Show us the code to see if we can help you somehow

    – miquelarranz
    Oct 4 '18 at 8:51












  • 2





    Show us the code to see if we can help you somehow

    – miquelarranz
    Oct 4 '18 at 8:51







2




2





Show us the code to see if we can help you somehow

– miquelarranz
Oct 4 '18 at 8:51





Show us the code to see if we can help you somehow

– miquelarranz
Oct 4 '18 at 8:51












2 Answers
2






active

oldest

votes


















0














There is an amazing tutorial on BottomSheet in AndroidHive



You can create a class extending BottomSheetDialogFragment.



public class BottomSheetFragment extends BottomSheetDialogFragment 
public BottomSheetFragment()
// Required empty public constructor


@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_bottom_sheet_dialog, container,
false);




And toggle it using below code



BottomSheetFragment bottomSheetFragment = new BottomSheetFragment();
bottomSheetFragment.show(getSupportFragmentManager(), bottomSheetFragment.getTag());





share|improve this answer























  • I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

    – Nitin4Android
    Oct 4 '18 at 8:56











  • Sounds like creating a Generic BottomSheetBehavior class is what you need.

    – Michael Lam
    Oct 4 '18 at 9:11



















-2














you can use BottomSheetDialogFragment, 
I imagine you want to do just like this: [https://cdn-images-1.medium.com/max/800/1*rLBf6fPtfWhXqnTOLlj0cQ.png][1]

create the navigationView file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@drawable/state_pressed"
app:menu="@menu/activity_main_drawer" />


</RelativeLayout>

</android.support.constraint.ConstraintLayout>

and create file menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/round_home_24"
android:title="Inicio"
android:checked="true"
android:checkable="true"/>
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/outline_settings_24"
android:title="Configuración"
android:checkable="true"/>
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/round_mail_outline_24"
android:title="Email"
android:checkable="true"/>
<item
android:id="@+id/nav_manage"
android:icon="@drawable/outline_search_24"
android:title="Buscar" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/outline_lock_24"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/outline_account_circle_24"
android:title="Send" />
</menu>
</item>

</menu>

and create the file for borderRadius

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="90dp" android:bottomLeftRadius="90dp" />
<padding android:left="30dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="30dp" android:topRightRadius="30dp" />
</shape>
</item>

</selector>

and create state_pressed backgroud color

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/border_radius_tabs">
<color android:color="@color/colorPrimary"></color>
</item>
<item android:state_checked="false">
<color android:color="@color/primaryLightColor"></color>
</item>

</selector>





share|improve this answer

























  • This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

    – Felipe Centeno
    Mar 8 at 0:53











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52641102%2fis-it-possible-to-have-persistent-bottom-sheet-as-a-fragment%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














There is an amazing tutorial on BottomSheet in AndroidHive



You can create a class extending BottomSheetDialogFragment.



public class BottomSheetFragment extends BottomSheetDialogFragment 
public BottomSheetFragment()
// Required empty public constructor


@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_bottom_sheet_dialog, container,
false);




And toggle it using below code



BottomSheetFragment bottomSheetFragment = new BottomSheetFragment();
bottomSheetFragment.show(getSupportFragmentManager(), bottomSheetFragment.getTag());





share|improve this answer























  • I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

    – Nitin4Android
    Oct 4 '18 at 8:56











  • Sounds like creating a Generic BottomSheetBehavior class is what you need.

    – Michael Lam
    Oct 4 '18 at 9:11
















0














There is an amazing tutorial on BottomSheet in AndroidHive



You can create a class extending BottomSheetDialogFragment.



public class BottomSheetFragment extends BottomSheetDialogFragment 
public BottomSheetFragment()
// Required empty public constructor


@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_bottom_sheet_dialog, container,
false);




And toggle it using below code



BottomSheetFragment bottomSheetFragment = new BottomSheetFragment();
bottomSheetFragment.show(getSupportFragmentManager(), bottomSheetFragment.getTag());





share|improve this answer























  • I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

    – Nitin4Android
    Oct 4 '18 at 8:56











  • Sounds like creating a Generic BottomSheetBehavior class is what you need.

    – Michael Lam
    Oct 4 '18 at 9:11














0












0








0







There is an amazing tutorial on BottomSheet in AndroidHive



You can create a class extending BottomSheetDialogFragment.



public class BottomSheetFragment extends BottomSheetDialogFragment 
public BottomSheetFragment()
// Required empty public constructor


@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_bottom_sheet_dialog, container,
false);




And toggle it using below code



BottomSheetFragment bottomSheetFragment = new BottomSheetFragment();
bottomSheetFragment.show(getSupportFragmentManager(), bottomSheetFragment.getTag());





share|improve this answer













There is an amazing tutorial on BottomSheet in AndroidHive



You can create a class extending BottomSheetDialogFragment.



public class BottomSheetFragment extends BottomSheetDialogFragment 
public BottomSheetFragment()
// Required empty public constructor


@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_bottom_sheet_dialog, container,
false);




And toggle it using below code



BottomSheetFragment bottomSheetFragment = new BottomSheetFragment();
bottomSheetFragment.show(getSupportFragmentManager(), bottomSheetFragment.getTag());






share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 4 '18 at 7:44









Michael LamMichael Lam

33628




33628












  • I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

    – Nitin4Android
    Oct 4 '18 at 8:56











  • Sounds like creating a Generic BottomSheetBehavior class is what you need.

    – Michael Lam
    Oct 4 '18 at 9:11


















  • I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

    – Nitin4Android
    Oct 4 '18 at 8:56











  • Sounds like creating a Generic BottomSheetBehavior class is what you need.

    – Michael Lam
    Oct 4 '18 at 9:11

















I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

– Nitin4Android
Oct 4 '18 at 8:56





I don't need Modal Bottom sheet. I want Persistent Bottom sheet.

– Nitin4Android
Oct 4 '18 at 8:56













Sounds like creating a Generic BottomSheetBehavior class is what you need.

– Michael Lam
Oct 4 '18 at 9:11






Sounds like creating a Generic BottomSheetBehavior class is what you need.

– Michael Lam
Oct 4 '18 at 9:11














-2














you can use BottomSheetDialogFragment, 
I imagine you want to do just like this: [https://cdn-images-1.medium.com/max/800/1*rLBf6fPtfWhXqnTOLlj0cQ.png][1]

create the navigationView file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@drawable/state_pressed"
app:menu="@menu/activity_main_drawer" />


</RelativeLayout>

</android.support.constraint.ConstraintLayout>

and create file menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/round_home_24"
android:title="Inicio"
android:checked="true"
android:checkable="true"/>
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/outline_settings_24"
android:title="Configuración"
android:checkable="true"/>
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/round_mail_outline_24"
android:title="Email"
android:checkable="true"/>
<item
android:id="@+id/nav_manage"
android:icon="@drawable/outline_search_24"
android:title="Buscar" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/outline_lock_24"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/outline_account_circle_24"
android:title="Send" />
</menu>
</item>

</menu>

and create the file for borderRadius

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="90dp" android:bottomLeftRadius="90dp" />
<padding android:left="30dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="30dp" android:topRightRadius="30dp" />
</shape>
</item>

</selector>

and create state_pressed backgroud color

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/border_radius_tabs">
<color android:color="@color/colorPrimary"></color>
</item>
<item android:state_checked="false">
<color android:color="@color/primaryLightColor"></color>
</item>

</selector>





share|improve this answer

























  • This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

    – Felipe Centeno
    Mar 8 at 0:53















-2














you can use BottomSheetDialogFragment, 
I imagine you want to do just like this: [https://cdn-images-1.medium.com/max/800/1*rLBf6fPtfWhXqnTOLlj0cQ.png][1]

create the navigationView file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@drawable/state_pressed"
app:menu="@menu/activity_main_drawer" />


</RelativeLayout>

</android.support.constraint.ConstraintLayout>

and create file menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/round_home_24"
android:title="Inicio"
android:checked="true"
android:checkable="true"/>
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/outline_settings_24"
android:title="Configuración"
android:checkable="true"/>
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/round_mail_outline_24"
android:title="Email"
android:checkable="true"/>
<item
android:id="@+id/nav_manage"
android:icon="@drawable/outline_search_24"
android:title="Buscar" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/outline_lock_24"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/outline_account_circle_24"
android:title="Send" />
</menu>
</item>

</menu>

and create the file for borderRadius

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="90dp" android:bottomLeftRadius="90dp" />
<padding android:left="30dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="30dp" android:topRightRadius="30dp" />
</shape>
</item>

</selector>

and create state_pressed backgroud color

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/border_radius_tabs">
<color android:color="@color/colorPrimary"></color>
</item>
<item android:state_checked="false">
<color android:color="@color/primaryLightColor"></color>
</item>

</selector>





share|improve this answer

























  • This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

    – Felipe Centeno
    Mar 8 at 0:53













-2












-2








-2







you can use BottomSheetDialogFragment, 
I imagine you want to do just like this: [https://cdn-images-1.medium.com/max/800/1*rLBf6fPtfWhXqnTOLlj0cQ.png][1]

create the navigationView file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@drawable/state_pressed"
app:menu="@menu/activity_main_drawer" />


</RelativeLayout>

</android.support.constraint.ConstraintLayout>

and create file menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/round_home_24"
android:title="Inicio"
android:checked="true"
android:checkable="true"/>
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/outline_settings_24"
android:title="Configuración"
android:checkable="true"/>
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/round_mail_outline_24"
android:title="Email"
android:checkable="true"/>
<item
android:id="@+id/nav_manage"
android:icon="@drawable/outline_search_24"
android:title="Buscar" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/outline_lock_24"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/outline_account_circle_24"
android:title="Send" />
</menu>
</item>

</menu>

and create the file for borderRadius

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="90dp" android:bottomLeftRadius="90dp" />
<padding android:left="30dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="30dp" android:topRightRadius="30dp" />
</shape>
</item>

</selector>

and create state_pressed backgroud color

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/border_radius_tabs">
<color android:color="@color/colorPrimary"></color>
</item>
<item android:state_checked="false">
<color android:color="@color/primaryLightColor"></color>
</item>

</selector>





share|improve this answer















you can use BottomSheetDialogFragment, 
I imagine you want to do just like this: [https://cdn-images-1.medium.com/max/800/1*rLBf6fPtfWhXqnTOLlj0cQ.png][1]

create the navigationView file

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">


<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@drawable/state_pressed"
app:menu="@menu/activity_main_drawer" />


</RelativeLayout>

</android.support.constraint.ConstraintLayout>

and create file menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/round_home_24"
android:title="Inicio"
android:checked="true"
android:checkable="true"/>
<item
android:id="@+id/nav_gallery"
android:icon="@drawable/outline_settings_24"
android:title="Configuración"
android:checkable="true"/>
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/round_mail_outline_24"
android:title="Email"
android:checkable="true"/>
<item
android:id="@+id/nav_manage"
android:icon="@drawable/outline_search_24"
android:title="Buscar" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/outline_lock_24"
android:title="Share" />
<item
android:id="@+id/nav_send"
android:icon="@drawable/outline_account_circle_24"
android:title="Send" />
</menu>
</item>

</menu>

and create the file for borderRadius

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff0000" />
<corners android:bottomRightRadius="90dp" android:bottomLeftRadius="90dp" />
<padding android:left="30dp"/>
</shape>
</item>
<item android:state_checked="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
<corners android:bottomRightRadius="30dp" android:topRightRadius="30dp" />
</shape>
</item>

</selector>

and create state_pressed backgroud color

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/border_radius_tabs">
<color android:color="@color/colorPrimary"></color>
</item>
<item android:state_checked="false">
<color android:color="@color/primaryLightColor"></color>
</item>

</selector>






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 26 at 20:16

























answered Mar 7 at 23:06









Alexander HDAlexander HD

262




262












  • This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

    – Felipe Centeno
    Mar 8 at 0:53

















  • This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

    – Felipe Centeno
    Mar 8 at 0:53
















This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

– Felipe Centeno
Mar 8 at 0:53





This seems like a good alternative to me, but can you provide some code as to how to use it? And maybe some ideas as of how you plan to make it reusable?

– Felipe Centeno
Mar 8 at 0:53

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52641102%2fis-it-possible-to-have-persistent-bottom-sheet-as-a-fragment%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко