任何人都可以幫助我如何爲linearlayout啓用滾動功能嗎?如何在android中啓用滾動功能以線性佈局?
11
A
回答
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
包裝你的內容的滾動型
內
10
你可以把任何一個滾動視圖內做出點(的LinearLayout,RelativeLayout的和等)滾動。您可以按照http://www.androidpeople.com/android-scrollview-example瞭解更多詳情。
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>
相關問題
- 1. 在android佈局中滾動功能
- 2. 在線性佈局中啓用水平滾動
- 3. 如何使線性佈局可滾動?
- 4. 線性佈局不滾動
- 5. 在線性佈局中拖放滾動
- 6. Android - 如何使用ListView在佈局上啓用整頁滾動?
- 7. Android動畫線性佈局
- 8. 在cardView + RecyclerView佈局中的Android滾動功能
- 9. 如何在一個線性佈局中滾動2個GridViews?
- 10. 以編程方式在線性佈局中滾動查看
- 11. 如何在滾動視圖中通過代碼生成android線性佈局?
- 12. 使線性佈局可滾動
- 13. 滾動線性佈局超出內容
- 14. 線性佈局兒童不滾動
- 15. 線性佈局嵌套的ListView滾動
- 16. 如何居中佈局? - 線性佈局
- 17. Android:使用三種線性佈局的水平滾動視圖
- 18. Android中的線性佈局始終可滾動
- 19. 在線性佈局中使用layout_weight Android
- 20. Android線性佈局
- 21. 如何在定向更改時使線性佈局可滾動
- 22. Android中的線性佈局
- 23. 如何在Android中滑動佈局(線性/相對..)
- 24. 如何在android studio中動態添加/刪除線性佈局
- 25. 如何在線性佈局
- 26. 如何在軟鍵盤開啓時移動線性佈局
- 27. 線性佈局裏面android中的線性佈局
- 28. Android:如何在線性佈局內設置網格佈局?
- 29. 在滾動視圖中動態添加線性佈局
- 30. 線性佈局內的相對佈局是否可以滾動查看?
刪除稱呼:「在此先感謝,\ n Sathish所在」,不這樣做,下一次 – 2015-05-21 18:18:34