2015-04-27 56 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

回答