gpt4 book ai didi

android - 如何在android中正确修复布局?

转载 作者:行者123 更新时间:2023-11-30 04:20:56 25 4
gpt4 key购买 nike

我正在开发测试应用程序。我需要显示问题和选项。事先不知道每个问题的选项数量。即每个问题都有不同数量的选项,因此我将动态显示选项

我的代码:

list.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>

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"?>
<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>

这里我的问题是基于问题的大小,布局正在扩展,否则布局只显示如图所示的一半屏幕。如何解决这个问题。我尝试了很多调整布局,但仍然面临同样的问题。请帮我解决这个问题。提前致谢..

enter image description here

最佳答案

检查你是否在某处给出了一些“layout_marginBottom”属性..

关于android - 如何在android中正确修复布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9256321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com