今天在布局页面的时候后犯了难,我要显示的内容一个页面展示不完,怎么办呢?

于是随便找了个app点开一看,哎呀原来还能翻动啊!这是啥布局呢?原来是ScrollView

官方api相关的内容全是英文,这可让三级b的我头大了好一通,不过没关系,不是有国内大神嘛

原来这个布局用法还真是粗暴:

加上标签<scrollview .....></scrollview>

就能用了,不过在宽度和高度的设置方面要注意,高度是万万不能是match_parent的

因为如果这样你会发现额啥都没了。这也很好理解因为控件本身不限制高度,如果你自己再不限制(充满)

自然就没有高度。

废话不多说:

直接上布局吧:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/normalbackground"
android:gravity="center"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/more_username"
android:text="王大锤"
android:textColor="#ffffff"
android:textSize="30dp"/> </LinearLayout> <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:layout_gravity="center_vertical"> </LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="拿快递"
android:textSize="30dp"
android:textColor="#000000"
android:id="@+id/more_title"
android:paddingTop="5dp"
android:paddingLeft="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="right"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥"
android:textColor="#ff0000"
android:textSize="30dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:textSize="30dp"
android:textColor="#ff0000"
android:id="@+id/more_price"
android:paddingRight="10dp"/>
</LinearLayout> </LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:orientation="horizontal"> <ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/ic_menu_camera"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="说明:"
android:paddingLeft="5dp"
android:textSize="25dp"/> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="前门天天快递 , 细节再聊"
android:id="@+id/more_explain"
android:textSize="20dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingTop="10dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2015-12-6 09:30 ~ 12:00"
android:id="@+id/more_date"
android:paddingRight="10dp"
android:textSize="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"> <ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/ic_menu_gallery"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收货地址:"
android:textSize="25dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="南信院 4#406B 我辈年轻收
askdfjalkfj
adsdfaddf
adssfasdff
asdffasdf"
android:textSize="20dp"
android:id="@+id/more_add"/>
</LinearLayout> <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:layout_gravity="right" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="电话:123456789001"
android:id="@+id/more_phone"
android:background="#ff6666"
android:textSize="20dp"/> </LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"> <Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="细聊"
android:id="@+id/more_chat"
android:background="#ccff99"
android:textSize="20dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/more_jie"
android:background="#6699cc"
android:text="接单"
android:textSize="20dp"/> </LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>

android 布局之scrollview的更多相关文章

  1. Android布局中ScrollView与ListView的冲突的最简单方法

    看到网上流行的一种使用方法是: public class Utility { public static void setListViewHeightBasedOnChildren(ListView ...

  2. android 布局文件 ScrollView 中的 listView item 显示不全解决方案

    import android.content.Context;import android.util.AttributeSet;import android.widget.ListView; /** ...

  3. Android UI系列-----ScrollView和HorizontalScrollView

    本篇随笔将讲解一下Android当中比较常用的两个布局容器--ScrollView和HorizontalScrollView,从字面意义上来看也是非常的简单的,ScrollView就是一个可以滚动的V ...

  4. Android开发:ScrollView嵌套GridView的解决办法

    Android开发:ScrollView嵌套GridView的解决办法   前些日子在开发中用到了需要ScrollView嵌套GridView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便 ...

  5. Android 布局 中实现适应屏幕大小及组件滚动

    要实现如图的布局: 这是在eclipse可视化窗口中的截图,但实际运行在Android设备上可能出现的问题有: (1):当编辑图1中的最后一个EditText时,输入法的编辑界面会把底部的Button ...

  6. Android 布局学习之——Layout(布局)具体解释二(常见布局和布局參数)

     [Android布局学习系列]   1.Android 布局学习之--Layout(布局)具体解释一   2.Android 布局学习之--Layout(布局)具体解释二(常见布局和布局參数)   ...

  7. [Android] Android最简单ScrollView和ListView滚动冲突解决方案

    [Question]问题描述: 单独的ListView列表能自动垂直滚动,但当将ListView嵌套在ScrollView后,会和ScrollView的滚动滑块冲突,造成ListView滑块显示不完整 ...

  8. Android 布局学习之——Layout(布局)详解二(常见布局和布局参数)

    [Android布局学习系列]   1.Android 布局学习之——Layout(布局)详解一   2.Android 布局学习之——Layout(布局)详解二(常见布局和布局参数)   3.And ...

  9. Android 布局控件——滚动条视图,日期,时间

    今天学长讲了一些控件,比较强的那种控件. 刚开始讲了图片,但是图片我前面写过了就跳过. 滚动条牛牛们应该很熟悉,也常用哈. 这是垂直的滚动条视图哈 一起来用吧! <ScrollView andr ...

随机推荐

  1. 没学过CSS等前端的我,也想美化一下自己的博客

    随便说几句: 自己一直学的都是 C++和 Java 以及 Python语言,根本不懂高大上的 CSS 和 著名的 HTML5.感觉那些能自己设计那么漂亮的博客的朋友都好厉害.可以自己加上博客公告栏的小 ...

  2. Linux vi 操作命令整理

    转自:http://www.lupaworld.com/?uid-296380-action-viewspace-itemid-118973   vi/vim 基本使用方法 本文介绍了vi (vim) ...

  3. android开发环境搭建日记和嵌入式Android开发环境初探

    非常感谢博客园的各位,按照你们的博文,还有利用百度和谷歌逐渐建立了android的开发环境,只是给自己备份参考查看,看过的人可以忽略这篇文章. 本文章大部分参考了:http://www.cnblogs ...

  4. jquery——滚动条插件jscroll.js

    一.效果如下 点击“测试中奖纪录”弹出弹框.弹框中内容超出时显示滚动条. 二.代码部分 1.html结构 <body> <a href="javascript:;" ...

  5. [转]C#面试题

    本文转自http://www.cnblogs.com/lhws/archive/2010/09/21/1827115.html 1.维护数据库的完整性.一致性.你喜欢用触发器还是自写业务逻辑?为什么? ...

  6. AC日记——数1的个数 openjudge 1.5 40

    40:数1的个数 总时间限制:  1000ms 内存限制:  65536kB 描述 给定一个十进制正整数n,写下从1到n的所有整数,然后数一下其中出现的数字“1”的个数. 例如当n=2时,写下1,2. ...

  7. [bzoj3289]Mato的文件管理

    Description Mato同学从各路神犇以各种方式(你们懂的)收集了许多资料,这些资料一共有n份,每份有一个大小和一个编号.为了防止他人偷拷,这些资料都是加密过的,只能用Mato自己写的程序才能 ...

  8. poj1573 Robot Motion

    Robot Motion Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12507   Accepted: 6070 Des ...

  9. Json 基于jQuery+JSON的省市联动效果

    helloweba.com 作者:月光光 时间:2012-09-12 21:57 标签: jQuery  JSON  Ajax  省市联动     省市区联动下拉效果在WEB中应用非常广泛,尤其在一些 ...

  10. 如何定位web前后台的BUG

    一.对系统整体的了解 Server端:jsp+Servlet+json 数据库:sql.MySQL.oracle等 前台: 涉及到 jstl,jsp,js,css,htm等方面 后台:servlet, ...