LinearLayout界面放置过多控件,导致下方控件不可见的解决方法:

来源:互联网 发布:什么是java远程调用 编辑:程序博客网 时间:2024/05/22 09:38

小编在进行项目的代码编写时,发现了该问题。最简单的方法便是使用滚动条,通过滑动,实现对下方控件的操作。

通过对相对应的布局xml文件进行操作,在最外层的LinearLayout布局外添加ScrollView。

代码实现:

<?xml version="1.0" encoding="utf-8"?>    <ScrollView        xmlns:android="http://schemas.android.com/apk/res/android"        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:scrollbars="vertical"        android:fadingEdge="vertical">        <LinearLayout            android:layout_width="fill_parent"            android:layout_height="fill_parent"            android:orientation="vertical"            >        </LinearLayout>    </ScrollView>   

说明:ScrollView是为控件或者布局添加滚动条。
拓展知识点说明:

ScrollView

始终显示srcollView的滚动条
android:scrollbars=”vertical”
android:fadeScrollbars=”false”

要两个参数都设置才能成功