2017-05-15 7 views
0

私は制約レイアウトを使用しています。私は画像ビューに画像を配置すると、タブバーと画像の間に巨大なスペースを持つ垂直方向の画面の中心に垂直に配置されます。私はそれを正確にタブバーの下に持っていくことはできません。画像の解像度は2048 * 1152です。私のアプリのバナーとして使うことを計画しています。アンドロイドのタブ付きバーの下にイメージビューを使用してイメージを配置する方法は?

<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
tools:context="com.manu.program.MainTwo"> 

<ImageView 
    android:id="@+id/imageView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:srcCompat="@drawable/banner_image" 
    /> 

</android.support.constraint.ConstraintLayout> 

私が添付された画像need to remove the space between the image and tab bar

+0

をadjustViewBoundsを追加=真の画像表示で –

+0

は、あなたの完全なXML –

+0

セットImageViewの高さwrap_content –

答えて

0

に示したように、私はタブの下にあなたのイメージを配置するには、結果を取得するアプリを実行すると、あなたが使用することができます。これは、コードである「アンドロイド:scaleType =」fitStart」 。これは、任意のアスペクト比に影響を与えずに、トップ、 にあなたのイメージがかかります。

<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.support.v7.widget.AppCompatImageView 
    android:id="@+id/section_label" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_marginBottom="0dp" 
    android:layout_marginLeft="0dp" 
    android:layout_marginRight="8dp" 
    android:layout_marginTop="0dp" 
    android:scaleType="fitStart" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintHorizontal_bias="0.0" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:layout_constraintVertical_bias="0.0" 
    app:srcCompat="@drawable/flower" /> 

</android.support.constraint.ConstraintLayout> 
+0

ありがとう、それは働いた。 – normalactivity

関連する問題