2017-03-25 5 views
0

私は左から右にスクロール可能な画像を含むhorizo​​ntalViewを持っています。画像はスクロールしますが、画像の周りにパディングが含まれていますので、画面全体を埋めるようにしたいと思います。これはどのように達成できますか?Androidスタジオ:Horizo​​ntalView

enter image description here

画像は、すべてのそれのまわりで私のXMLコードをグレーのスペースがあります。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
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:id="@+id/activity_rear_gunner" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:focusable="true" 
tools:context="com.example.mr_br.ibcc_bomber_command.rear_gunner"> 

<HorizontalScrollView 
    android:id="@+id/horizontalScrollView1" 

    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" 
    android:layout_alignParentTop="true" 
> 


<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"  app:srcCompat="@drawable/background_scroll_2" 
    android:id="@+id/imageView2" android:layout_centerVertical="true" 

/> 

</HorizontalScrollView> 
</RelativeLayout> 

この原因は何ですか?

答えて

1

ImageViewでandroid:scaleType = "centerCrop"を設定して、画像が画面全体に収まるようにすることができます。

+0

ありがとう、私が達成したいと思っていたことをありがとう。 –

+0

喜びはすべて私のものです –

関連する問題