develop an appllication that demonstrate the use of ScrollView.
Develop an android application that demonstrate the use of Scrollview.
activity_main.xml
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:divider="?android:dividerHorizontal" android:orientation="vertical" android:showDividers="middle" android:dividerPadding="2dp">
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="MCOM" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="NMA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="AJAVA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="PPD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="WDT" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="JAVA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FCA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="OS" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=".NET" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FSD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="COA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CPD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="c++" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ACP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ACP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FDE" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="PROJECT-1" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="PROJECT-2" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
</LinearLayout>
</ScrollView>
MainActivity.java<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:divider="?android:dividerHorizontal" android:orientation="vertical" android:showDividers="middle" android:dividerPadding="2dp">
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="MCOM" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="NMA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="AJAVA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="PPD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="WDT" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="JAVA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FCA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="OS" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=".NET" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FSD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
<TextView
android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="COA" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CPD" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="c++" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ACP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ACP" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FDE" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="PROJECT-1" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" /> <TextView android:padding="7dp" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="PROJECT-2" android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
</LinearLayout>
</ScrollView>
package com.mr.pr9_mcom;
import android.support.v7.app.AppCompatActivity; import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setTitle("ScrollView");
setContentView(R.layout.activity_main);
}
}
Output:-import android.support.v7.app.AppCompatActivity; import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setTitle("ScrollView");
setContentView(R.layout.activity_main);
}
}
No comments: