EditText嵌套到ScrollView中时无法完全铺满

2020-10-13  本文已影响0人  蓝不蓝编程

问题描述

单独EditText时,可以完全铺满父控件,但是放到ScroolView后,就缩成一行了.

解决方案

在ScrollView中增加android:fillViewport="true".
如:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:fillViewport="true">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        android:gravity="top"
        android:inputType="textMultiLine" />

</ScrollView>
上一篇 下一篇

猜你喜欢

热点阅读