如何在Android应用中实现滚动和滚动条? 我是新来的android开发建议除了android开发者网站以外的一些网站快速学习。Android滚动视图
-2
A
回答
0
很简单,打开你的Android Studio中,创建新项目(空白项目)。然后在res/layout/activity_main.xml
替换此代码:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test1" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test2" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test3" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test4" />
.
.
.
.
.
<!-- something you want to display -->
</LinearLayout>
</ScrollView>
对于学习Android的,我建议这个网站,它有很多的干净清澈的例子让你尝试(它的旧的,但对我来说是很好的初学者):
又一次谷歌是你最好的朋友。
0
这是一个简单的任务,您可以通过使用ScrollView
来实现此目的。把Layout
放在一边ScrollView
,你就可以走了。有一件事ScrollView
只能包含一个ChildView。
实施例:
<ScrollView
android:width="match_parent"
android:height="match_parent" >
<LinearLayout
....>
.
.
.
</LinearLayout>
</ScrollView>
2
这里是一个垂直滚动视图的示例:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"/>
...
</LinearLayout>
</ScrollView>
和水平滚动视图:
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/horizontalScrollView"
android:layout_below="@+id/scrollView"
android:layout_alignParentStart="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"/>
...
</LinearLayout>
</HorizontalScrollView>
相关问题
- 1. 滚动视图内滚动视图android
- 2. Android滚动视图
- 3. Android的滚动视图自动滚动
- 4. Android:滚动图像视图
- 5. Android的滚动视图不滚动
- 6. Android:滚动视图不再滚动
- 7. 滚动视图不滚动android
- 8. TextView在滚动视图不滚动 - Android
- 9. 的Android滚动视图不滚动
- 10. 在Android中滚动视图
- 11. 滚动视图问题Android
- 12. Android滚动视图太长
- 13. Android - 滚动视图问题
- 14. Android Recycler视图滚动条
- 15. Android XML滚动视图
- 16. android水平滚动视图
- 17. 在android中滚动视图
- 18. Android - 操作滚动视图
- 19. 滚动视图Android故障
- 20. ImageView内滚动视图(Android)
- 21. 多滚动视图android
- 22. Android:关于滚动视图
- 23. Android - 无法滚动视图
- 24. Android网格视图滚动
- 25. Android嵌套滚动视图
- 26. 在android问题的滚动视图内滚动视图
- 27. 更改滚动视图在android的滚动视图的颜色
- 28. android-如何把滚动视图下滚动视图
- 29. Android:滚动滚动视图内的线性视图
- 30. 在滚动视图时滚动视图内的android动画视图
问题要求我们推荐或找到一本书,工具,软件库,教程或其他非本地资源,因为它们倾向于吸引自以为是的答案和垃圾邮件,所以不适合堆栈溢出。相反,请描述问题以及到目前为止解决问题所做的工作。 – Lexi
在youtube上搜索。 –