How to add a panel in Android?

I want to add a panel to android activity. I will try to explain her behavior.

He should show a small arrow on the right side of my activity. If I click on a panel with several buttons, you should get about 20% -30% of the current activity out of it.

Something like a menu appears on the screen.

Thanks in advance.

+6
android panel
source share
2 answers

See the SlidingDrawer widget. However, this widget will only move up in older versions of the SDK.

Otherwise, you should consider using fragments (if necessary, using the compatibility API). You can find some explanations about how the GMail application is built, or an example of the HoneyComb gallery for information on fragment animation.

+7
source share

Here is my panel example

<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:background="@drawable/border"> <TextView android:text="@string/panel_title" android:id="@+id/groupTitle" android:paddingLeft="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/blue" /> Here you add panel content... </LinearLayout> 

You also need to add to drawable resource broder.xml

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="3dip" android:color="#d3d3d3" /> </shape> 

And color in values โ€‹โ€‹/Colors.xml

 <?xml version="1.0" encoding="utf-8" ?> <resources> <item name="blue" type="color">#FF33B5E5</item> </resources> 

And the name of the panel in the values โ€‹โ€‹/Strings.xml

 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="panel_title">Panel 1</string> </resources> 

As for the buttons and animations, which can be added separately.

0
source share

All Articles