Android 如何在布局背景中插入图像?
在android的登录布局背景中插入图像。如下-Android 如何在布局背景中插入图像?,android,Android,在android的登录布局背景中插入图像。如下- <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/loginLayout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/loginLayout" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/background">
....
....
</RelativeLayout>
....
....
xml格式:
android:background="@drawable/your_image"
代码内(setBackgroundDrawable
自API 16以来已被弃用,但仍然有用)
自API 16起:
.setBackground(Drawable d)
只需将此android:background=“drawable/yourimage”
设置到您的login.xml的父布局中
android:background=“@drawable/yourback”为什么这不是真正的问题?它很短但很清楚。android:orientation=“vertical”它对RelativeLay有用吗???@PadmaKumar足够了吗?请参见编辑。
.setBackground(Drawable d)
<?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:background="@drawable/ad_screenfull"
android:orientation="vertical" >
</LinearLayout>