【发布时间】:2017-01-12 19:26:03
【问题描述】:
我从 url 获取图像,但它不适合屏幕,因为它在浏览器上显示...请帮助..我尝试了一切..这个 url "http://i.imgur.com/DvpvklR.png" 这是图片
如果我们在浏览器上运行 url,我们可以在我的设备上看到它略微上升..我希望它在我的设备上看起来很完美
这是我的 xml 文件:
<RelativeLayout 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"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7">
<ImageView
android:id="@+id/ms1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/main1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3">
<ImageView
android:id="@+id/ms2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:scaleType="fitXY"
android:src="@drawable/pl2" />
<ImageView
android:id="@+id/ms3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:scaleType="fitXY"
android:src="@drawable/l1" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
您希望将图像设置为屏幕的背景图像,并将其他两个图像放在它上面吗?
-
不,这是第一张图片,下面的图片是第二张和第三张
-
主屏幕图像没有背景图像
-
它是 70:30 的比例,第一张图像应占屏幕的 70%,其他图像应占 30%
-
对于您正确使用权重的比率并在 ImageView 中正确调整图像显示图像,您可以设置 adjustViewBounds="true"