Friday, 28 August 2015

Vertical ScrollView in Android

Activity_main.xml
----------------------
<ScrollView  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/hh">

    <
LinearLayout
       
android:layout_width="match_parent"
       
android:layout_height="match_parent"
       
android:orientation="vertical"
       
tools:context=".MainActivity">


    <
Button
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button" />

    <
Button
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button2" />

    <
Button
       
style="?android:attr/buttonStyleSmall"
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button3" />

    <
CheckBox
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New CheckBox"
       
android:id="@+id/checkBox" />

    <
RadioButton
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New RadioButton"
       
android:id="@+id/radioButton" />

    <
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/textAppearanceSmall"
       
android:text="Small Text"
       
android:id="@+id/textView" />

    <
TextView
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:textAppearance="?android:attr/textAppearanceLarge"
       
android:text="Large Text"
       
android:id="@+id/textView3" />

    <
TextView
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:textAppearance="?android:attr/textAppearanceMedium"
       
android:text="Medium Text"
       
android:id="@+id/textView6" />

    <
Button
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button10" />

    <
TextView
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:textAppearance="?android:attr/textAppearanceMedium"
       
android:text="Medium Text"
       
android:id="@+id/textView5" />

    <
TextView
       
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
       
android:textAppearance="?android:attr/textAppearanceLarge"
       
android:text="Large Text"
       
android:id="@+id/textView4" />

    <
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/button8" />

    <
Button
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button9" />

    <
Button
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button4"
       
android:layout_gravity="center_horizontal" />

    <
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/button6" />

    <
Button
       
style="?android:attr/buttonStyleSmall"
       
android:layout_width="wrap_content"
       
android:layout_height="wrap_content"
       
android:text="New Button"
       
android:id="@+id/button5" />
</
LinearLayout>
</
ScrollView>


There No Java Code Just We need to Change the Xml or Html Code

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







No comments:

Post a Comment