【发布时间】:2014-09-28 21:18:43
【问题描述】:
我在启动画面的时候解析了JSON,其中的图片url被解析为登录屏幕的背景图片。这是登录屏幕的示例XMLcode:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/loginLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_bg" <!-- I want to change this background dynamically. -->
android:focusableInTouchMode="true"
android:gravity="center"
tools:context=".activity.LoginActivity" >
<ScrollView
android:id="@+id/mainScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- .... Here is edit text for login inputs and buttuns for singnup and login. -->
</LinearLayout>
</ScrollView>
</RelativeLayout>
在上面我已经在RelativeLayout的背景中放置了静态图像,但我想根据图像url将背景设置为可变的。
提前致谢。
【问题讨论】:
标签: android xml json layout imageurl