案例布局
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- >
- <!-- ScrollView 将布局包在里面 -->
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- tools:context=".MainActivity" >
- </LinearLayout>
- </ScrollView>
复制代码
MainActivity.java - package com.example.day07_19_scrollview;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.widget.Button;
- import android.widget.LinearLayout;
- import android.widget.LinearLayout.LayoutParams;
- public class MainActivity extends Activity {
- private LinearLayout content;
- private LinearLayout.LayoutParams style;
- //定义Btn中的数据显示
- private String [] dates = new String[]{<span style="line-height: 1.5;">"</span>聪哥QQ:717350389<span style="line-height: 1.5;">",</span><span style="line-height: 1.5;">"美女","金钱","性","人生","梦想","真理","爱情","亲情","友情","黄聪","张焕焕","李庆怡","贺小军","张萌","陶拓","狂飙的yellowcong"};</span>
复制代码
效果图
|
|