我正在尝试制作类似于下拉菜单的内容,但我也想让它充当标题栏。
我原本想让标题栏能够向下滑动并显示带有可点击项目的listView。不幸的是,在标题栏中放置一个布局并不顺利。
相反,我决定制作一个自定义标题栏,并给它一个0的大小,(我不想使用标志FEATURE_NO_TITLE,因为它也删除了状态栏)
到目前为止,我有一些向下滑动但与父宽度不匹配的东西。使其可滑动的textView布局不对齐左侧。我想弄清楚如何使背景成为整个"滑动抽屉的不同颜色"
我需要帮助:
感谢您的帮助
在我的主要活动中,我只是将标题设置为自定义标题,将内容视图设置为以下XML。
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slidingDrawer"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:content="@+id/content"
android:gravity="center_horizontal"
android:handle="@+id/handle"
android:orientation="vertical"
android:rotation="180" >
<LinearLayout
android:id="@+id/handle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="180"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pull Here"/>
</LinearLayout>
<ImageView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:rotation="180"
android:src="@drawable/ic_launcher" />
答案 0 :(得分:2)
我建议你试试SlidingMenu库。你可以找到它here
答案 1 :(得分:0)
看起来你正在重新发明轮子。有许多功能完善的滑动抽屉库。你几乎可以从顶部,左侧,右侧或底部有一个抽屉滑动,甚至可以将它们放在像列表视图行那样疯狂的位置。
查看应用程序 - Libraries for Developers,其中列出了每个库以及演示和演示文稿。 github链接。如果你选择一个并根据需要定制它会更好。