Friday, 28 August 2015

Horizontal ScrollView in Android

Activity_main.xml
---------------------------
<HorizontalScrollView

    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:id="@+id/my">

<LinearLayout

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="horizontal"

    tools:context=".MainActivity">

  <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button" />



    <CheckBox

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New CheckBox"

        android:id="@+id/checkBox3" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button8" />



    <TextView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:textAppearance="?android:attr/textAppearanceMedium"

        android:text="Medium Text"

        android:id="@+id/textView2" />



    <TextView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:textAppearance="?android:attr/textAppearanceLarge"

        android:text="Large Text"

        android:id="@+id/textView" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button6" />



    <CheckBox

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New CheckBox"

        android:id="@+id/checkBox" />



    <CheckBox

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New CheckBox"

        android:id="@+id/checkBox2" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button5" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button7" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button4" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button2" />



    <Button

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="New Button"

        android:id="@+id/button3" />

</LinearLayout>

</HorizontalScrollView>
 There No Java Code Just We need to Change the Xml or Html Code

Output is :
-------------









No comments:

Post a Comment