Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fix the layout properly in android?
    text
    copied!<p>I am working on test application. I need to display the <strong>questions and options</strong>. The number of options for each question are not known before hand. i.e <strong>for each question there are different number of options</strong> and hence I am displaying the <strong>options dynamically</strong>.</p> <p><strong>My Code:</strong></p> <p><strong>list.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;com.splash.Header android:id="@+id/layoutheader" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" /&gt; &lt;ListView android:layout_height="wrap_content" android:id="@+id/listview" android:layout_width="fill_parent"&gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>header.xml</strong> </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/topbar" android:layout_width="330dip" android:layout_height="wrap_content" android:background="@drawable/topplain" &gt; &lt;/ImageView&gt; &lt;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" &gt; &lt;/ImageView&gt; &lt;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" &gt; &lt;/ImageView&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>listitem.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;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" &gt;&lt;/TextView&gt; &lt;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"&gt; &lt;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" &gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Here my problem is <strong>based on the size of the question the layout is expanding otherwise the layout is displaying only upto half screen as shown in the picture.</strong> How to solve this issue. I tried a lot to adjust the layout but still I am facing the same problem. Please help me regarding this. Thanks in advance..</p> <p><img src="https://i.stack.imgur.com/p4ehf.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload