我想有一個Android應用程序,它的背景圖像在視圖的底部。 希望這可以通過只使用XML來實現。Android - 背景底部
我的背景圖片(bg.png)位於文件夾「res/drawable-mdpi」。 的XML代碼現在:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dip" />
</LinearLayout>
但是,這在整個頁面拉伸整個圖像。我只想要它在水平方向拉伸。 高度必須與(伸展的)寬度成比例。 而這個圖像必須是背景的視圖/佈局,我想繼續使用佈局並添加項目/對象。
我希望有人可以幫助我,我一直在網上看了幾個小時,我找不到任何更有幫助,然後我現在。
由於提前,
丹尼斯
這也不起作用。現在圖像尺寸很大(寬度拉伸,高度與寬度成正比),但此圖像不在應用程序/視圖的底部。它垂直居中。 – Dennis
難以從這裏調試...嘗試添加scaleType =「fitEnd」到你的imageview。它會下降到底部嗎? – Damian