ScrollView 垂直滚动视图
HorizontalScrollView 水平滚动视图
基础属性
1、layout_width | 宽度 |
---|---|
2、layout_height | 高度 |
3、id | 设置组件id |
1、layout_width
2、layout_height
组件宽度和高度有4个可选值,如下图:
3、id
// activity_main.xml
android:id="@+id/cb1" // 给当前控件取个id叫cb1
// MainActivity.java
ScrollView sv1=findViewById(R.id.sv1); // 按id获取控件
程序示例:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="wrap_content">
<LinearLayout
android:layout_width="</