android - imageView - 以编程方式设置非资源图像

时间:2015-04-27 21:03:15

标签: android layout imageview picasso

我需要开发这个例子:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 

        android:scaleType="center"
        android:src="@drawable/golden_gate" />

    <TextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="20dip"
        android:layout_gravity="center_horizontal|bottom"

        android:padding="12dip"

        android:background="#AA000000"
        android:textColor="#ffffffff"

        android:text="Golden Gate" />

</FrameLayout>

但由于从互联网(通过毕加索)读取imageView,我需要以编程方式设置图像资源。 android:src="@drawable/golden_gate"对我来说毫无用处。有任何想法吗?感谢

1 个答案:

答案 0 :(得分:0)

picasso占位符选项应该让您分配占位符图像,该图像会显示,直到从网络下载实际图像

http://square.github.io/picasso/

相关问题