zoukankan      html  css  js  c++  java
  • ScrollView&HorizontalScrollView

    将布局方式改为ScrollView或HorizontalScrollView
    注意这两个的子元素只能有一个,所以往往要将多级子元素先套在一个Linear Layout里面。

    activity_main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <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=".MainActivity"
    android:orientation="vertical">
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <Button
    android:id="@+id/btn_textview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="TextView"
    android:textAllCaps="false"/>
    <Button
    android:id="@+id/btn_button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Textbutton"
    android:textAllCaps="false"/>
    <Button
    android:id="@+id/btn_edittext"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="EditText"
    android:textAllCaps="false"/>
    <!--textAllCaps即内容全部大写 -->
    <Button
    android:id="@+id/btn_radiobutton"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="RadioButton"
    android:textAllCaps="false"/>
    <!--textAllCaps即内容全部大写 -->
    <Button
    android:id="@+id/btn_checkbox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="CheckBox"
    android:textAllCaps="false"/>
    <Button
    android:id="@+id/btn_imageview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="ImageView"
    android:textAllCaps="false"/>
    <Button
    android:id="@+id/btn_listview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="ListView"
    android:textAllCaps="false"/>
    <Button
    android:id="@+id/btn_gridview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="GridView"
    android:textAllCaps="false"/>
    <HorizontalScrollView//水平滚动
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal">//水平对齐
    <Button
    android:layout_width="200dp"
    android:layout_height="300dp"
    android:text="蕾姆"
    android:textAllCaps="false"/>
    <Button
    android:layout_width="200dp"
    android:layout_height="300dp"
    android:text="蕾姆"
    android:textAllCaps="false"/>
    <Button
    android:layout_width="200dp"
    android:layout_height="300dp"
    android:text="蕾姆"
    android:textAllCaps="false"/>
    </LinearLayout>
    </HorizontalScrollView>
    <Button
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="text"
    android:layout_marginTop="300dp"
    android:textAllCaps="false"/>

    </LinearLayout>

    </ScrollView>

  • 相关阅读:
    Linux基础(Ubuntu16.04):安装vim及配置
    Ubuntu16.04 安装ROS及其IDE
    python格式转换的记录
    python爬虫selenium相关
    【LAMP】搭建Web网站过程中的记录【Ubuntu18.04+Apache2.4+PHP7.2+MySQL5.7】
    【疯狂挖坑】linux服务器尝试中的问题(nohup等)
    逻辑回归与全连接神经网络联系的简单理解记录
    Unity3d开发中遇到的问题记录
    python中numpy库的一些使用
    Deep Learning论文翻译(Nature Deep Review)
  • 原文地址:https://www.cnblogs.com/ltw222/p/14903617.html
Copyright © 2011-2022 走看看