Reputation: 4497
I want create a ListView on a fragment.
That ListView must be "hide" and only appear when I clik a button.
Attached pictures of what I need know.
If I click on center button (the arrow button) a ListView appear from bottom.
If I click again the arrow button a ListView hide again.
I dont need open new Activity, I need that ListView on the same Activity but I dont know how I can show ListView and Hide .
Can you help me for that?
Upvotes: 0
Views: 526
Reputation: 8134
Reference from this Drawer Demo Project on GitHub
You can use the class MultiDirectionSlidingDrawer.java and include the ListView
in a separate layout which will act as the container of what is going to slide up.
In your Activity
, suppose the content view is: main_layout
i.e. setContentView(R.layout.main_layout);
Then include the drawer in your main_layout
like:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
arrow to open />
<package.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/yourpackageforslider"
android:id="@+id/drawer"
//here you specify the direction
my:direction="bottomToTop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
my:handle="@+id/handle" //this is the button -arrow
my:content="@+id/content" -content (which would identify your listview layout)>
<include
android:id="@id/content"
layout="@layout/layoutContainingYourListview" />
<ImageView
android:id="@id/handle"
button for it to push it up/down />
</package.MultiDirectionSlidingDrawer>
</RelativeLayout>
Your listView
would remain completely independent of the code above and in a different layout -- layoutContainingYourListview. This is good as the drawer sliding up becomes irrespective of its content - which you can change and work with dynamically too.
Upvotes: 0