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;
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
add a comment |
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
2
Show us the code to see if we can help you somehow
– miquelarranz
Oct 4 '18 at 8:51
add a comment |
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
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
android android-fragments android-design-library bottom-sheet
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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());
I don't need Modal Bottom sheet. I want Persistent Bottom sheet.
– Nitin4Android
Oct 4 '18 at 8:56
Sounds like creating a GenericBottomSheetBehavior
class is what you need.
– Michael Lam
Oct 4 '18 at 9:11
add a comment |
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>
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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());
I don't need Modal Bottom sheet. I want Persistent Bottom sheet.
– Nitin4Android
Oct 4 '18 at 8:56
Sounds like creating a GenericBottomSheetBehavior
class is what you need.
– Michael Lam
Oct 4 '18 at 9:11
add a comment |
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());
I don't need Modal Bottom sheet. I want Persistent Bottom sheet.
– Nitin4Android
Oct 4 '18 at 8:56
Sounds like creating a GenericBottomSheetBehavior
class is what you need.
– Michael Lam
Oct 4 '18 at 9:11
add a comment |
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());
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());
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 GenericBottomSheetBehavior
class is what you need.
– Michael Lam
Oct 4 '18 at 9:11
add a comment |
I don't need Modal Bottom sheet. I want Persistent Bottom sheet.
– Nitin4Android
Oct 4 '18 at 8:56
Sounds like creating a GenericBottomSheetBehavior
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
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
Show us the code to see if we can help you somehow
– miquelarranz
Oct 4 '18 at 8:51