2017-10-07 7 views
1

自分のコンテンツの最後がそれらのボタンの下にあるので、レイアウトを背面、自宅、最近のボタンのアンドロイドから一番下に合わせたいと思っています。私は以下のコードを添付した線形レイアウトの制約レイアウトのスクロールビューを使用しましたが、私はさまざまな方法で試しましたが、修正できませんでした。 :あなたの助けアクションバーの下部からレイアウトを整えよう

バック、家庭、そして最近のボタンの/ 感謝

enter image description here

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    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:layoutDirection="rtl" 
    android:orientation="horizontal" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="test.NewsPageActivity" 
    tools:showIn="@layout/activity_news_page"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginBottom="8dp" 
    android:textDirection="rtl"> 

    <android.support.constraint.ConstraintLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp"> 

     <TextView 
      android:id="@+id/titleNewsPage" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="8dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginRight="8dp" 
      android:layout_marginStart="8dp" 
      android:layout_marginTop="8dp" 
      android:padding="5dp" 
      android:text="title" 
      app:layout_constraintHorizontal_bias="0.5" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toTopOf="parent" /> 

     <ImageView 
      android:id="@+id/imageView" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_marginEnd="8dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginRight="8dp" 
      android:layout_marginStart="8dp" 
      android:layout_marginTop="11dp" 
      android:src="@drawable/image" 
      app:layout_constraintHorizontal_bias="0.5" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/titleNewsPage" /> 

     <TextView 
      android:id="@+id/textNewsPage" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="8dp" 
      android:layout_marginEnd="8dp" 
      android:layout_marginLeft="8dp" 
      android:layout_marginRight="8dp" 
      android:layout_marginStart="8dp" 
      android:layout_marginTop="8dp" 
      android:padding="5dp" 
      android:text="content" 
      app:layout_constraintBottom_toBottomOf="parent" 
      app:layout_constraintHorizontal_bias="0.5" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/imageView" 
      app:layout_constraintVertical_bias="0.0" /> 

    </android.support.constraint.ConstraintLayout> 
</ScrollView> 
</LinearLayout> 

答えて

0

画面の一番下にあなたのcontrolssを追加するためにandroid:layout_alignParentBottom="true"を使うよりも、親としてこの使用RelativeLayoutを試してみてください以下のようなサンプルコード

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true"> 

    <LinearLayout 
     android:layout_alignParentBottom="true" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:src="@drawable/ic_launcher" /> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:src="@drawable/ic_launcher" /> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:src="@drawable/ic_launcher" /> 

    </LinearLayout> 

</RelativeLayout> 
0

プロパティの追加android:fillViewport="true"からscrollview

そうでない場合は相対レイアウトを使用して、imageviewプロパティを設定android:layout_alignParentBottom .. true

関連する問題