I created a vertical linear layout and placed many items in it, and only part of them can be displayed on the screen. I can see the first several items of the layout but can't see the last several items of the layout. How can I make the linear layout scrollable so the user can scroll the screen to see the last several items of the linear layout? following is the content of the layout xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView_gridw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Grid Width"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_gridw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView_gridh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Height"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_gridh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
<TextView
android:id="@+id/textView_gridbt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Border thickness"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_gridborderthickness"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView_bgw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="BgImg Width"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_bgw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:focusable="false"
android:inputType="number" />
<TextView
android:id="@+id/textView_bgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Height"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_bgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:focusable="false"
android:inputType="number" />
<TextView
android:id="@+id/textView_mtgw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="MTG Width"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_mtgw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
<TextView
android:id="@+id/textView_mtgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="Height"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_mtgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Margin(left, top, right, bottom):"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/editText_margin_l"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
<EditText
android:id="@+id/editText_margin_t"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
<EditText
android:id="@+id/editText_margin_r"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
<EditText
android:id="@+id/editText_margin_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number" />
</LinearLayout>
<TextView
android:id="@+id/textView_pathname_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Background image file path name:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_pathname_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView_pathname_thumbdir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Thumbnail images directory path name:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_pathname_thumbdir"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView_pathname_treasure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Treasure image file path name:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_pathname_treasure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView_pathname_signature"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Signature image file path name:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/editText_pathname_signature"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="reset"
android:text="Reset" />
<Button
android:id="@+id/button_apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="apply"
android:text="Apply" />
</LinearLayout>
</LinearLayout>
You should wrap your LinearLayout
in a ScrollView:
Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With