Difference between revisions of "Android: ScrollView Container"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
(Created page with " <source language="java"> package com.conobel.android.Beginning_Android_2; import android.app.Activity; import android.os.Bundle; public class Scroll_View extends Activity { @...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
https://lh6.googleusercontent.com/_vH60i-IVw0M/TYfyXAjKJEI/AAAAAAAAC5A/PcF5cUpndJw/s400/img_%202011-03-21_01.gif
  
<source language="java">
+
 
package com.conobel.android.Beginning_Android_2;
+
<source lang="java">
 +
package com.android.sample;
  
 
import android.app.Activity;
 
import android.app.Activity;
Line 14: Line 16:
 
}
 
}
 
</source>
 
</source>
 +
 +
<source lang="java">
 +
<?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="fill_parent"
 +
android:stretchColumns="0">
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#000000"/>
 +
<TextView android:text="#000000"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#440000" />
 +
<TextView android:text="#440000"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#884400" />
 +
<TextView android:text="#884400"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#aa8844" />
 +
<TextView android:text="#aa8844"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#ffaa88" />
 +
<TextView android:text="#ffaa88"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#ffffaa" />
 +
<TextView android:text="#ffffaa"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
<TableRow>
 +
<View
 +
android:layout_height="80px"
 +
android:background="#ffffff" />
 +
<TextView android:text="#ffffff"
 +
android:paddingLeft="4px"
 +
android:layout_gravity="center_vertical" />
 +
</TableRow>
 +
</TableLayout>
 +
</ScrollView>
 +
</source>
 +
 +
[[Category:Android_Sample_Codes]]

Latest revision as of 20:04, 21 March 2011

img_%202011-03-21_01.gif


<source lang="java"> package com.android.sample;

import android.app.Activity; import android.os.Bundle;

public class Scroll_View extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.scroll_view); } } </source>

<source lang="java"> <?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="fill_parent" android:stretchColumns="0"> <TableRow> <View android:layout_height="80px" android:background="#000000"/> <TextView android:text="#000000" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#440000" /> <TextView android:text="#440000" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#884400" /> <TextView android:text="#884400" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#aa8844" /> <TextView android:text="#aa8844" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#ffaa88" /> <TextView android:text="#ffaa88" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#ffffaa" /> <TextView android:text="#ffffaa" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> <TableRow> <View android:layout_height="80px" android:background="#ffffff" /> <TextView android:text="#ffffff" android:paddingLeft="4px" android:layout_gravity="center_vertical" /> </TableRow> </TableLayout> </ScrollView> </source>