Android HorizontalScrollView布局
解决UI过多,单屏幕显示不下的情况:
主程序代码:
package com.example.androidhorizontalscrollviewtest;import android.os.Bundle; import android.app.Activity; import android.view.Menu;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu);return true;}}
View Code
xml布局文件:
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="fill_parent"android:layout_height="fill_parent"> <LinearLayout android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/hello_world" /></LinearLayout></HorizontalScrollView>
View Code
运行效果:
转载于:https://www.cnblogs.com/MMLoveMeMM/articles/3343820.html
Android HorizontalScrollView布局相关推荐
- android horizontalscrollview 动画,Android HorizontalScrollView左右滑动效果
本文实例为大家分享了Android HorizontalScrollView左右滑动的具体代码,供大家参考,具体内容如下 效果图 一.什么是HorizontalScrollView Horizonta ...
- android HorizontalScrollView讲解
前言 本章内容是android.widget.HorizontalScrollView,译为"横向滚动条",版本为Android 2.3 r1,翻译来自"Tina&quo ...
- Android HorizontalScrollView左右滑动
Android HorizontalScrollView左右滑动 效果图 一.什么是HorizontalScrollView HorizontalScrollView实际上是一个FrameLayout ...
- android如何看百分比版本,【JAVA】Android百分比布局
开发我人生第一个app的时候,我在想有没有这么一种布局能适应任何手机的分辨率,今天让我们一起来看看Android 百分比布局PercentRelativeLayout. 使用这种布局首先我们要在gra ...
- Android开发——布局性能优化的一些技巧(一)
0. 前言 上一篇我们分析了为什么LinearLayout会比RelativeLayout性能更高,意义在于分析了这两种布局的实现源码,算是对一个小结论的证明过程,但是对布局性能的优化效果,对这两种布 ...
- 浅谈Android五大布局——LinearLayout、FrameLayout和AbsoulteLa
为什么80%的码农都做不了架构师?>>> Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了 ...
- android源代码居中字体,Android (布局优化) TextView实现drawable图标大小 位置与第一行文本居中...
先看大众点评的购买须知 大众.png 如上图,需求在每条提示语句前加一个小圆点,我刚看到需求就想到用 android:drawableLeft 来做,可做完发现:当TextView内容为单行的时候是没 ...
- Android 线性布局(LinearLayout)相关官方文档 - 布局參数部分
Android 线性布局(LinearLayout)相关官方文档 - 布局參数部分 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商 ...
- Android帧布局(Frame Layout)
Android帧布局(Frame Layout) FrameLayout是最简单的一个布局管理器.FrameLayout为每个加入其中的组件创建一个空白区域(一帧),这些组件根据layout_grav ...
最新文章
- linux c编译错误storage class specified for parameter XXX
- 【Android 应用开发】AndroidUI设计 之 图片浏览器
- 与顶级互联网公司技术大佬面对面聊聊RocketMQ
- HDU - 6959 zoto 莫队 + 值域分块
- vue delete删除json数组_vue面试题总结(二)
- svn 钩子 post-commit 出现255错误解决办法
- C# XElement
- 机器学习之密度聚类(DBSCAN)
- HDU 1521 排列组合 (指数型母函数)
- python3 数独解法 深度遍历
- connection pool exhausted
- 【JY】为什么要了解和学习多款仿真软件?
- LeetCode455分发饼干
- 关于@Autowired属性飘红
- Linux修改和恢复服务器时间
- 利用Arcgis Engine 二次开发的使用和总结
- python代替易语言_基于hook的python机器人,彻底取代itchat
- 学习日记之三:RFC2198文档阅读
- 关于Java垃圾回收问题的总结
- IA-32汇编语言笔记(2)—— IA32处理器及其寄存器
热门文章
- 为什么母鸡不需要公鸡就能生蛋?那公鸡存在的意义是什么?
- 模型类型与加速潜力的关系
- 如何将namedtuples序列化为JSON
- 实战-动手开发第一个区块链投票DAPP
- IDEA的创建javaWeb工程以及修改默认的class文件输出
- HTML中常见问题汇总贴
- sql数据库 订阅发布_如何使用中央发布者和多个订阅者数据库设置自定义SQL Server事务复制
- ssas还原数据库_SSAS数据库管理
- always on_Always On可用性组中的自动播种
- dmv io读写高的sql_使用内置的动态管理视图(DMV)发现更多SQL Server信息