2015-04-27 55 views
-1

我需要开发这个例子:机器人 - 的ImageView - 设置非资源型图像编程

<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"对我来说没用。有任何想法吗?感谢

+0

http://developer.android.com/reference/android/下载时显示widget/ImageView.html#setImageResource(int) – Blundell

+0

是的,我已经见过'public void setImageResource(int resId)'多次,但在这种情况下,它是如何设置的?毕加索函数为: 'picasso.load(foto.getURL()) \t \t \t \t \t .placeholder(R.raw.place_holder) \t \t \t \t \t .error(R.raw.big_problem) \t \t \t \t \t .resize(150,150) \t \t \t \t \t .centerCrop() \t \t \t \t \t .into(imageView);' – moshlp

+0

目前还不清楚你想要做什么。你想以编程方式设置什么?位图?一个可绘制的? – Simas

回答