Java 如何拉伸微调器的图像?
我有一个内部只有图像的旋转器。Java 如何拉伸微调器的图像?,java,android,spinner,Java,Android,Spinner,我有一个内部只有图像的旋转器。 我可以将图像拉伸到整个微调器上吗 row.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView
我可以将图像拉伸到整个微调器上吗 row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/country_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"/>
</LinearLayout>
如果你使用
android:scaleType="fitXY"
您的图像将覆盖整个显示区域。请尝试以下操作:
<ImageView
android:id="@+id/country_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image"/>
如果其API 7或更低版本使用fill_parent而不是match_parent。还要确保图标在其内部适当拉伸,并且没有不必要的透明背景使图标比实际需要的更大谢谢你说得对,我没有注意到图像有不必要的透明背景。
<ImageView
android:id="@+id/country_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image"/>