开发者

it may sound like a trivial question but who i make my layout scrollable

scrollable meaning by the user touch he can can go up and down in the layout given

this is what i did and the emulator throw an exception null pointer somthing and i have problems figuring out from where it comes ....

<?xml version="1.0" encoding="UTF-8"?>
<ScrollView>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">


<LinearLayout

 android:layout_width="wrap_content" 
 android:layout_height="wrap_content">
 <TextView 
 android:text="Country City Game(aka CCG) is an acdemic work of MTA students enjoy the game"
  android:textSize="24.5sp"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"></TextView>
 </LinearLayout>




</TableLayout>
</ScrollView>

this one doesn开发者_StackOverflowt work but when i drop

   <ScrollView> </ScrollView> 

it works can some one explain to me what's wrong ?


Try this instead

<?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="fill_parent">

<TableLayout 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:stretchColumns="1">

<TableRow>

  <TextView 
   android:text="Country City Game(aka CCG) is an acdemic work of MTA students enjoy the game"
   android:textSize="24.5sp"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"></TextView>

</TableRow>

</TableLayout>

</ScrollView>


Surround the layout you want to have a scroll bar attached with a ScrollView


Put your entire layout that you want to be able to scroll inside a ScrollView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜