Bukan Materi Pelajaran yang Sulit, tapi Memulai Untuk Belajar itu yang Sulit.

Code Android Scroll View

1:10 AM Posted by develop code source No comments
Layout container for a canvass organization that can be scrolled by the individual, allowing it to be large than the somatic showing. A ScrollView is a FrameLayout, import we should localise one tiddler in it containing the entire contents to scroll; this nipper may itself be a layout administrator with a complex hierarchy of objects. A somebody that is oft old is a LinearLayout in a straight orientation, presenting a perpendicular clothing of top-level items that the user can manuscript through.

Code main.xml :

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content">
 <TableLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:stretchColumns="0">
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#ff0000"/>
   <TextView android:text="@string/cff0000"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#ff7f00" />
   <TextView android:text="@string/cff7f00"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#ffff00" />
   <TextView android:text="@string/cffff00"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#00ff00" />
   <TextView android:text="@string/c00ff00"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#0000ff" />
   <TextView android:text="@string/c0000ff"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#6600ff" />
   <TextView android:text="@string/c6600ff"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
  <TableRow>
   <View
    android:layout_height="40dp"
    android:background="#8b00ff" />
   <TextView android:text="@string/c8b00ff"
    android:paddingLeft="4dp"
    android:layout_gravity="center_vertical" />
  </TableRow>
 </TableLayout>
</ScrollView>
and strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="hello">Hello World, ScrollViewActivity!</string>
    <string name="app_name">ScrollView</string>
    <string name="cff0000">#ff0000</string>
    <string name="cff7f00">#ff7f00</string>
    <string name="cffff00">#ffff00</string>
    <string name="c00ff00">#00ff00</string>
    <string name="c0000ff">#0000ff</string>
    <string name="c6600ff">#6600ff</string>
    <string name="c8b00ff">#8b00ff</string>

</resources>


Download Project Android ScrollView.zip

0 komentar:

Post a Comment