【发布时间】:2015-03-11 23:00:49
【问题描述】:
我正在制作一个应用程序,我有以下 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#f4f4f4" >
<ExpandableListView
android:id="@+id/lvExp"
android:layout_width="match_parent"
android:layout_height="325dp" />
<Button
android:id="@+id/add_claim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Claim" />
</LinearLayout>
我制作了一个名为 View_list 的按钮,它只想查看整个页面上的可展开列表视图。我所做的是创建一个新的 XML 文件,并添加了以下包含语句:
<include android:id="@+id/lvExp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
但是,我意识到这现在可以工作有两个原因
1 - 没有布局 ID
2- 我只想要列表,而不是按钮和我要放入原始布局的所有其他内容。将会发生的情况是,如果我在列表中添加了一些东西,我需要能够在没有添加 antthing 选项的情况下查看它。
因此我的问题是这样的:
如何找到布局 ID,如何防止整个布局显示,只显示列表。我真的很感激一些建议。
【问题讨论】: