如何在android中正确修复布局?
我正在做测试申请。我需要显示问题和选项。每个问题的选项数量目前尚不清楚。i、 e每个问题都有不同数量的选项,因此我动态显示选项 我的代码: list.xml如何在android中正确修复布局?,android,Android,我正在做测试申请。我需要显示问题和选项。每个问题的选项数量目前尚不清楚。i、 e每个问题都有不同数量的选项,因此我动态显示选项 我的代码: list.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id=
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/linearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.splash.Header
android:id="@+id/layoutheader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<ListView
android:layout_height="wrap_content"
android:id="@+id/listview"
android:layout_width="fill_parent">
</ListView>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:id="@+id/lnrlayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_question"
android:text=""
android:textColor="#000000"
android:layout_below="@+id/casedescription"
android:layout_marginTop="10dp"
></TextView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="@+id/rlt_main"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:id="@+id/chkboxes"
android:layout_below="@+id/tv_question"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
header.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/topbar"
android:layout_width="330dip"
android:layout_height="wrap_content"
android:background="@drawable/topplain"
>
</ImageView>
<ImageView
android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/homebtn"
android:layout_marginTop="4dp"
android:layout_alignParentLeft="true"
>
</ImageView>
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/backbtn"
android:layout_marginTop="4dip"
android:layout_marginLeft="255dip"
android:layout_alignParentRight="true"
android:onClick="back"
>
</ImageView>
</RelativeLayout>
listitem.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/linearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.splash.Header
android:id="@+id/layoutheader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<ListView
android:layout_height="wrap_content"
android:id="@+id/listview"
android:layout_width="fill_parent">
</ListView>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:id="@+id/lnrlayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_question"
android:text=""
android:textColor="#000000"
android:layout_below="@+id/casedescription"
android:layout_marginTop="10dp"
></TextView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="@+id/rlt_main"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:id="@+id/chkboxes"
android:layout_below="@+id/tv_question"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
这里我的问题是根据问题的大小,版面正在扩展,否则版面只显示到半个屏幕,如图所示。如何解决此问题。我尝试了很多调整布局,但仍然面临同样的问题。请帮我解决这个问题。提前谢谢
我想应该切断列表项中的
滚动视图标记
编辑
<?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="#FFFFFF"
android:id="@+id/lnrlayout">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lnrlayout1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_question"
android:text=""
android:textColor="#000000"
android:layout_marginTop="10dp"
></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/rlayout1">
<LinearLayout
android:orientation="vertical"
android:id="@+id/checkboxes"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</LinearLayout>
</LinearLayout>
</LinearLayout>
我想应该把列表项中的滚动视图
标记切掉
编辑
<?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="#FFFFFF"
android:id="@+id/lnrlayout">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lnrlayout1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_question"
android:text=""
android:textColor="#000000"
android:layout_marginTop="10dp"
></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/rlayout1">
<LinearLayout
android:orientation="vertical"
android:id="@+id/checkboxes"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</LinearLayout>
</LinearLayout>
</LinearLayout>
您可以在XML布局中使用布局:权重
属性,在那里您可以为标题和列表视图设置所需的布局权重。然后列表视图和标题宽度将相应地调整。
您可以在XML布局中使用布局:权重
属性,在那里您可以为标题和列表视图设置所需的布局权重。然后列表视图和标题宽度将相应地调整。
检查您必须在某个地方提供一些“layout\u marginBottom”属性。检查您必须在某个地方提供一些“layout\u marginBottom”属性。您最好使用相对布局,而不是线性布局。我应该为哪一个使用相对布局。。这是用于listview的吗?当您想要显示问题选项时,请弹出一个自定义对话框(包含选项的列表视图)当单击特定问题时,我使用了相对布局,但仍然存在相同的问题…请帮助我了解android:layout\u width=“fill\u parent”android:layout\u height=“fill\u parent”此用法的列表android:layout\u width=“match\u parent”android:layout\u height=“match\u parent”你最好使用相对布局而不是线性布局I我应该使用相对布局哪一个..这是用于listview的吗?当你想显示问题选项时,请弹出一个自定义对话框(其中包含选项的listview)当点击特定问题时,我使用了相对布局,但仍然存在相同的问题……请帮助我了解android:layout\u width=“fill\u parent”android:layout\u height=“fill\u parent”这一用法的详细信息android:layout\u width=“match\u parent”android:layout\u height=“match\u parent”嗨,我删除了scrollview,但即使这样,我也面临着问题。我已经编辑了我的答案。请尝试最新的答案,我不知道它是否会有帮助。猜猜看。另外,你真的需要使用相对布局吗?嗨,我已经编辑了我的listitem.xml文件。但即使这样,它也不起作用。请帮助我,我不确定我是否能帮助你。无论如何,如果你认为我可以帮你,你的代码不是秘密。你可以给我发电子邮件。我会看一看。嗨,我删除了scrollview,但即使这样我也面临着问题。我已经编辑了我的anser,请尝试最新的答案,我不知道这是否会有帮助。猜猜看。另外,你真的需要使用相对布局吗?嗨,我已经编辑了我的listitem.xml文件。但即使如此它不起作用请帮我,我不确定我能帮你。不管怎样,如果你认为我能帮你,你的代码不是秘密。你可以发电子邮件给我。我会看一看。嗨,谢谢你的回复…你能在这里给我一个代码的例子吗…提前谢谢你的回复…你能给我一个代码的例子吗nce