Я использую ScrollView для хранения и отображения изображения статической карты размером 480 px x 904 px и реализовано так, что я могу прокручивать вверх и вниз для просмотра карты. Я реализовал так, чтобы ScrollView соответствовал и заполнял экран. Однако, похоже, он не может растянуть изображение карты в соответствии с экраном, и я не уверен, что я сделал неправильно. Изображение карты представляет собой изображение с 9 патчами, где разрешено растягивать только правый край.ScrollView не растягивает ImageView в соответствии с экраном?
Вот код XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rlayoutResultMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="0dp" >
<ScrollView
android:id="@+id/scrollResultMap"
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:scrollbars="none" >
<RelativeLayout
android:id="@+id/rlayoutScrollMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imgResultMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:src="@drawable/map_base"/>
</RelativeLayout>
</ScrollView>
<ImageButton
android:id="@+id/btnBack"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@android:color/transparent"
android:contentDescription="@string/btnBack_desc"
android:scaleType="centerInside"
android:src="@drawable/back_button" />
<TextView
android:id="@+id/tickerWeather"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#80000000"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="@string/weather_feed_init_text"
android:textColor="#ffffffff" />
<ImageView
android:id="@+id/imgMapZoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/tickerWeather"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="10dp"
android:src="@drawable/map_zoom_icon" />
</RelativeLayout>
Спасибо заранее.
Спасибо! Ты прав. Мне просто нужно установить scaleType = "fixXY", и все хорошо! – Kenny