2011-06-10 70 views

回答

11

使用ScrollView?

<LinearLayout android:id="@+id/LinearLayout01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
<ScrollView android:id="@+id/ScrollView01" 
android:layout_width="fill_parent" 
android:layout_height="110px"> 
+0

我怎么能做到这一点不使用的LinearLayout内滚动视图? – sathish 2011-06-10 11:53:14

+0

你不想要ScrollView的任何原因? – Reno 2011-06-10 11:54:46

+1

scrollview是你在找什么。它只能包含一个子布局,如果需要,可以在其中一个xml属性中移除侧边的滚动条。 – manno23 2011-06-10 12:17:56

0

包装你的内容的滚动型

0

滚动视图只能有一个项目在它.. 所以要启用的功能,你必须把线性布局(一般..)和 作为孩子添加自定义视图或布局,线性布局..

我建议你使用listview和ArrayLists来生成一个滚动列表

0

滚动视图将只带一个直接的孩子在它下面。你可以使用这个代码作为sample.hope这将帮助你。

<TableLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> 

<TableLayout android:id="@+id/syncservice_url" android:layout_width="wrap_content" android:layout_height="match_parent" > 
    <TextView android:text="Settings" android:textColor="@color/Black" android:textSize="6pt" android:typeface="serif"/> 
<View android:background="@color/Black" android:layout_height="1dip" android:layout_marginBottom="5dip"/> 

     <TextView android:text="Multimedia file list Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/multimediafileListUrl" android:layout_height="40dip"></EditText> 



     <TextView android:text="Multimedia Download Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/MultiMediaDownloadUrl" android:layout_height="40dip"></EditText> 



     <TextView android:text="Reports Upload Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/ReportUploadUrl" android:layout_height="40dip"></EditText> 



     <TextView android:text="Presentation Timimg Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/PresentationTimeUrl" android:layout_height="40dip"></EditText> 


</TableLayout><!-- sync scrvice closed --> 

    <TableLayout android:id="@+id/report_url" android:layout_width="wrap_content" android:layout_height="match_parent" > 

    <TextView android:text="Reporting " android:textColor="@color/Black" android:textSize="6pt" android:typeface="serif"/> 
    <View android:background="@color/Black" android:layout_height="1dip" android:layout_marginBottom="5dip"/> 


     <TextView android:text="Report Submit Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/ReportSubmitUrl" android:layout_height="40dip"></EditText> 



     <TextView android:text="Appointment List Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 

<EditText android:gravity="left" android:maxLines="1" 
        android:layout_marginRight="10dip" 
        android:cursorVisible="false" android:layout_width="match_parent" 
        android:layout_height="40dip" android:id="@+id/AppointMentListUrl" /> 

    </TableLayout><!-- sync Report closed --> 
    <TableLayout android:id="@+id/Locationmap_url" android:layout_width="wrap_content" android:layout_height="match_parent" > 


     <TextView android:text="IMEI Post Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/IMeiPostUrl" android:layout_height="wrap_content"></EditText> 



     <TextView android:text="Kml Download Url" android:textColor="@color/Black" android:textSize="5pt" android:typeface="serif" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> 
    <EditText android:layout_width="match_parent" android:id="@+id/kmldownloadurl" android:layout_height="wrap_content"></EditText> 

    <Button android:text="Save" android:id="@+id/SettingSave" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>  
</TableLayout><!--Locationmap closed --> 

</TableLayout><!-- main table layout --> 
</TableLayout><!-- main table layout --> 

</ScrollView> 

0

使用滚动型,提供他的宽度和长度,然后使用任何布局或视图,为他们提供他们的宽度和高度。

3

将您的内容里面滚动型

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <ScrollView android:id="@+id/ScrollViewID" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent"> 
    <!-- your content ---> 
    </ScrollView> 
    </LinearLayout>