现在我有一个滑动菜单,如下所示,
我想像foursquare滑动菜单一样设计它,
这是我的布局
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/oneButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:drawableLeft="@drawable/ic_dashboard" android:gravity="left|center_vertical" android:text="@string/duo_dashboard" /> <Button android:id="@+id/twoButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/oneButton" android:layout_marginLeft="5dp" android:drawableLeft="@drawable/ic_settings" android:gravity="left|center_vertical" android:text="@string/title_settings" /> <Button android:id="@+id/threeButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/twoButton" android:layout_marginLeft="5dp" android:drawableLeft="@drawable/ic_todo" android:gravity="left|center_vertical" android:text="@string/title_todo" /> </RelativeLayout> </LinearLayout> </RelativeLayout>
答案 0 :(得分:1)
由Android提供: 显示导航栏
http://developer.android.com/design/patterns/navigation-drawer.html
答案 1 :(得分:0)
这里只是一个猜测。分线器可以通过分频器属性来实现。
<ListView
android:id="@+id/left_drawer"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@drawable/gradientshape" <!--thats what im talking about-->
android:dividerHeight="0.5dp" />
其中gradientshape必须是渐变xml文件,如此
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="@color/dark_black" <!--use whatever colors you like-->
android:endColor="@color/light_grey"
android:type="linear"
android:angle="270" /> </shape>
编辑:只看了foursquare资源,色彩和线条阴影实际上是通过9个补丁图像实现的