<ScrollView> 滚动视图的简单功能和用法
来源:互联网 发布:淘宝店铺粉丝最多 编辑:程序博客网 时间:2024/06/05 16:28
ScrollView是由Framelayout派生出来的,它就是一个用于为普通组件添加滚动条的组件.ScrollView里最多只能包含一个组件,而ScrollView的作用就是为组件添加垂直滚动条.
package com.crazyit.ui.scrollviewdemo;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;/** * ScrollView 的功能与简单用法 */public class ScrollViewActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_scroll_view); }}
布局文件
<?xml version="1.0" encoding="utf-8"?><!--定义ScrollView 为里面的组件添加垂直滚动条--><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.crazyit.ui.scrollviewdemo.ScrollViewActivity"> <HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="滚动视图滚动视图滚动视图滚动视图" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> </LinearLayout> </HorizontalScrollView></ScrollView>
ScrollView组件里面 最多只能包含一个组件
0 0
- <ScrollView> 滚动视图的简单功能和用法
- ScrollView滚动视图和WebView
- Gallery的简单功能和用法(画廊视图)
- scrollView中视图滚动调用的方法
- Xamarin.Forms的滚动视图ScrollView
- 滚动视图 ScrollView
- ScrollView 滚动视图组件
- ScrollView滚动视图
- 07 ScrollView 滚动视图
- 滚动视图控件ScrollView
- iOS8 scrollView滚动视图
- Android ScrollView 滚动视图
- ScrollView 滚动视图
- 画廊视图(Gallery)的功能和用法
- scrollView的滚动和缩放
- ScrollView的用法,隐藏滚动条
- Scrollview滚动条用法
- android 滚动视图(ScrollView)
- 利用x64_dbg破解一个最简单的64位小程序
- 时区与时间
- window7 上安装 php扩展
- 《Indy In Depth》中文版
- 解决maven打包编译出现using platform encoding GBK, i.e. build
- <ScrollView> 滚动视图的简单功能和用法
- nginx、php-fpm以及mysql运行在各个用户下的配置
- Android之eclipse NDK开发环境的搭建
- Pycharm连接Github
- LeetCode Swap Nodes in Pairs
- dataset总结
- 链接和库
- ListView的点击事件应用
- Batch Normalization导读