[英]Android: Sliding Drawer
我在我的应用程序上使用滑动抽屉(实际上它是一个面板)。 我想让该面板可滚动。 我怎样才能做到这一点?
这是该部分的 xml 代码:
<org.miscwidgets.widget.Panel
android:id="@+id/rightPanel3"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
panel:animationDuration="500"
panel:closedHandle="@android:drawable/ic_menu_directions"
panel:content="@+id/panelContent"
panel:handle="@+id/panelHandle"
panel:linearFlying="true"
panel:openedHandle="@android:drawable/ic_menu_directions"
panel:position="right"
panel:weight="75%p" >
<Button
android:id="@+id/panelHandle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dip" />
<TextView
android:id="@+id/panelContent"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#000000"
android:gravity="left"
android:padding="4dip"
android:text="Directions"
android:textColor="#eee"
android:textSize="16dip"
android:textStyle="bold" />
</org.miscwidgets.widget.Panel>
做你想做的事很简单。 您需要将 TextView @+id/panelContent 包装在 ScrollView 中。 这将允许滚动打开的 SlidingDrawer 中的内容。 这是您要执行的操作的代码。
<org.miscwidgets.widget.Panel
android:id="@+id/rightPanel3"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
panel:animationDuration="500"
panel:closedHandle="@android:drawable/ic_menu_directions"
panel:content="@+id/panelContent"
panel:handle="@+id/panelHandle"
panel:linearFlying="true"
panel:openedHandle="@android:drawable/ic_menu_directions"
panel:position="right"
panel:weight="75%p" >
<Button
android:id="@+id/panelHandle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dip" />
<ScrollView
android:id="@+id/panelContent"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
andrid:fillViewport="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#000000"
android:gravity="left"
android:padding="4dip"
android:text="Directions"
android:textColor="#eee"
android:textSize="16dip"
android:textStyle="bold" />
</ScrollView>
</org.miscwidgets.widget.Panel>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.