0

私はそこにアンドロイドアプリケーションを開発しています。他のビューの下にWebviewを配置し、すべてのビューを一緒にスクロールするにはどうすればいいですか?

コンテンツ全体が画面に表示されないため、一部のスクロールを有効にしたいとします。

マイレイアウトファイルは、次のようになります

<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/white" 
    tools:layout_editor_absoluteX="8dp" 
    tools:layout_editor_absoluteY="8dp"> 

    <TextView .../> 
    <TextView .../> 
    <TextView .../> 
    <TextView .../> 

    <WebView 
     android:id="@+id/about_detail" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="24dp" 
     android:textSize="14sp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toBottomOf="@+id/contactInformation" 
     tools:layout_constraintLeft_creator="1" 
     tools:layout_constraintRight_creator="1" 
     tools:layout_constraintTop_creator="1" /> 

</android.support.constraint.ConstraintLayout> 

私は私の周りConstraintLayout Scrollviewを使用すべきか、私はそれをどのように行うことができますか?

+0

。 –

+0

私はconstraintlayoutの最初の子としてscrollviewを入れましたが、今はwebviewだけがスクロール可能で、前のビューは来ません。 –

答えて

2

あなたは、コードの下に試すことができます:それはあなたのConstraintLayoutのもみ子としてScrollViewを追加することで可能とし、ScrollViewの子としてさらなる要素を追加する必要があります

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <TextView .../> 
     <TextView .../> 
     <TextView .../> 
     <TextView .../> 

     <WebView 
      android:id="@+id/about_detail" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_marginTop="24dp" 
      android:textSize="14sp" /> 
    </LinearLayout> 

</android.support.v4.widget.NestedScrollView> 
関連する問題