簡體   English   中英

NestedScrollview在CoordinatorLayout的Cardview內部具有EditText不會填充視口

[英]NestedScrollview with an EditText inside Cardview inside CoordinatorLayout doesn't fill viewport

我的活動中的布局類似於以下內容:

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingLeft="10dip"
            android:paddingRight="10dip">

        <EditText
            android:id="@+id/noteBodyEdit"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inputType="textCapSentences|textMultiLine"
            android:overScrollMode="always"
            android:scrollbarStyle="insideInset"
            android:scrollbars="vertical" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.v7.widget.CardView>

此視圖作為內容視圖包含在CoordinatorLayout中,並添加了帶有工具欄的標准AppbarLayout。

使用此代碼,我希望Scrollview和EditText填充所有內容視圖。 但是,以這種形式,它們以wrap_content行為結束。

如果我更改代碼並將layout_behavior從CardView移到Scrollview,則fillportview問題已修復,但是工具欄部分覆蓋了內容。

任何想法如何解決這兩種方式:

  1. 在CardView上使用行為並拉伸ScrollView填充視口
  2. 或者,使用ScrollView上的行為並將其顯示在工具欄下方。

我更新到支持庫23.0.0后,問題似乎消失了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM