![](/img/trans.png)
[英]How to put a button inside group item in an ExpandableListView?
[英]how to put a button at the end of ExpandableListview dynamically in android
在我的应用程序中,我有一个扩展 ExpandableListActivity 的活动,我想在 ExpandableListview 的末尾放置一个按钮,这样如果我扩展它应该在 listview 的末尾。
问题是在展开 Expandablelistview 中的所有项目后,它会全屏显示并且按钮不会出现。 如何使用 ExpandableListview 滚动按钮? 我也试图给 Scrollview 但它不起作用。 给我一个方法,我应该在 xml 文件中写什么以获得正确的 o/p。 谢谢
创建一个包含要设置为页脚的Button
的页脚footerview layout
,然后尝试
View footerView = ((LayoutInflater)ActivityContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_layout, null, false);
ListView.addFooterView(footerView);
Footer_layout xml 文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="7dip"
android:paddingBottom="7dip"
android:orientation="horizontal"
android:gravity="center">
<LinearLayout
android:id="@+id/footer_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_gravity="center">
<Button
android:id="@+id/footer_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip">
</Button>
</LinearLayout>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.