滚动型底部隐藏线性布局 [英] ScrollView hides bottom Linear Layout

查看:114
本文介绍了滚动型底部隐藏线性布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的XML布局在我的Andr​​oid应用程序,使用滚动:

I have the following XML layout in my android application, using ScrollView:

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

<TextView.../>


<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout1">
    <CheckBox ...>
        <requestFocus></requestFocus>    
    </CheckBox>
    <CheckBox ..></CheckBox>
</LinearLayout>

<ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" >
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:text="Block Type:" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<RadioGroup android:orientation="horizontal" android:id="@+id/inputType" android:layout_width="wrap_content" android:layout_height="wrap_content">
    <RadioButton android:id="@+id/btCall" android:paddingRight="10px" android:text="Call" android:layout_height="wrap_content" android:layout_width="wrap_content" android:checked="true"></RadioButton>
    <RadioButton android:id="@+id/btSMS" android:paddingRight="10px" android:text="SMS" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
    <RadioButton android:id="@+id/btBoth" android:paddingRight="10px" android:text="Call + SMS" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
</RadioGroup>
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/chooseContactButton" android:text="Choose from contacts..."></Button>

<TextView android:text="Name:" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:id="@+id/inputName">d</EditText>

<TextView android:text="Number:" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="phone" android:id="@+id/inputNumber"></EditText>

<TextView android:text="SMS to send:" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:text="I'm busy right now." android:inputType="textMultiLine" android:layout_width="match_parent" android:layout_height="wrap_content" android:minLines="3" android:enabled="false" android:id="@+id/inputMsg"></EditText>
</LinearLayout>
</ScrollView> 

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_gravity="bottom">
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/okButton" android:text="Save" android:width="150px" android:visibility="gone"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/updateButton" android:text="Update" android:width="150px" android:visibility="gone"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/removeButton" android:text="Remove" android:width="150px" android:visibility="gone"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cancelButton" android:text="Cancel" android:width="150px"></Button>
</LinearLayout>

</LinearLayout>

上面滚动型观冻结罚款和放大器;视图滚动不够好。 问题是,含有的按钮的LinearLayout被揭去图。它不能被看见。

The Views above ScrollView freeze fine & the view scrolls good enough. The problem is that the LinearLayout containing Buttons is thrown off the view. It cannot be seen.

任何帮助是极大的AP preciated。 谢谢你。

Any help is greatly appreciated. Thanks.

推荐答案

在滚动型,请尝试更改安卓layout_height FILL_PARENT添加的android:layout_weight =1

On the ScrollView, try changing android:layout_height to "fill_parent" adding android:layout_weight="1".

此应该使滚动型设置其高度,以您的组按钮和其上方的其他视图之间的差距。

This should make the ScrollView set its height to the gap between your set of buttons and the other views above it.

此外,尽量不要设置滚动型为WRAP_CONTENT的高度,它没有意义,因为它的全部意义在于通过内容滚动(一个固定的高度内)。

Also, try not to set the height of the ScrollView to "wrap_content", it doesn't make sense as the whole point of it is to scroll through content (within a fixed height).

这篇关于滚动型底部隐藏线性布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆