zoukankan      html  css  js  c++  java
  • HorizontalScrollView水平滚动控件

       一、HorizontalScrollView控件只是支持水平滚动,而且它只能包含一个控件,通常是在< HorizontalScrollView >标签中定义了一个<LinearLayout>

    标签并且在<LinearLayout>标签中android:orientation属性值设置为horizontal,然后在<LinearLayout>标签中放置多个控件,如果<LinearLayout>标签中的控件所占用的总宽度超出屏幕的宽度,就会出现滚动效果
      二、下面是实例:
    在main.xml文件中:
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     3     android:layout_width="fill_parent" android:layout_height="wrap_content">
     4 
     5     <LinearLayout android:orientation="horizontal"
     6         android:layout_width="fill_parent" android:layout_height="fill_parent">
     7 
     8         <ImageView android:layout_width="wrap_content"
     9             android:layout_height="wrap_content" android:src="@drawable/item1"></ImageView>
    10         <ImageView android:layout_width="wrap_content"
    11             android:layout_height="wrap_content" android:src="@drawable/item2"></ImageView>
    12 
    13         <ImageView android:layout_width="wrap_content"
    14             android:layout_height="wrap_content" android:src="@drawable/item3"></ImageView>
    15 
    16         <ImageView android:layout_width="wrap_content"
    17             android:layout_height="wrap_content" android:src="@drawable/item4"></ImageView>
    18 
    19         <ImageView android:layout_width="wrap_content"
    20             android:layout_height="wrap_content" android:src="@drawable/item5"></ImageView>
    21     </LinearLayout>
    22 </HorizontalScrollView>

    .java文件没有加入代码.

    运行结果:

    注意:水平方向出现滑动条

  • 相关阅读:
    KINDLE 小说下载--超级书库
    修改PR Cs6,PS Cs6,AU Cs6的启动界面
    SQLMAP用户手册
    Burp Suite 实战指南--说明书
    XSS跨站测试代码
    万能密码字典
    python数据结构之队列(一)
    python数据结构之栈
    python实现链表(二)
    python实现链表(一)
  • 原文地址:https://www.cnblogs.com/SoulCode/p/5405990.html
Copyright © 2011-2022 走看看