在很多时候页面的文字过多或是需要显示的功能过多,导致下半部分无法显示,
这时候就可以使用ScrollView来帮助使用者滑动页面,显示出後半部分的画面。
android:scrollX:设定水平方向滚动的的偏移值(单位:像素)
android:scrollY:设定垂直方向滚动的的偏移值(单位:像素)
android:scrollbarAlwaysDrawHorizontalTrack:设定是否始终显示垂直滚动条
android:scrollbarAlwaysDrawVerticalTrack:设定是否始终显示垂直滚动条
android:scrollbarSize:设定滚动条的宽度
android:scrollbarStyle:设定滚动条的风格和位置
但使用ScrollView时必须把ScrollView放置於layout以及需要滑动的原件外!
当我把需要显示的文章放置於String.xml里
ScrollView的xml范例如下:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/des"
android:textSize="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</ScrollView>
这样就可以垂直滑动页面
>>: 第24车厢-翻起来惹!页面翻页效果turn.js应用篇
MVC架构 MVC是软件工程中的一种软件架构模式,是基於关注点分离(seperation of co...
Maven简介 Day08_Maven简介 ...
在 Day03 我们使用 GCE 建立一台 VM,今天要学习如何连线到虚拟机,并在服务器上使用 No...
若市场总是有效率,我就是在街上乞讨的流浪汉。 I'd be a bum on the street ...
本文将於赛後同步刊登於笔者部落格 有兴趣学习更多 Kubernetes/DevOps/Linux 相...