2013-10-20 190 views

回答

1

按照意圖行動,intent.setAction(Intent.ACTION_GET_CONTENT);機器人自動將用戶帶到新的系統活動來選擇文件。所以不涉及此代碼所具有的按鈕和佈局。

1

你應該添加「main.xml中」水庫/佈局(如果不存在!) 並追加此代碼是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" >  

<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/textView1" 
    android:layout_below="@+id/textView1" 
    android:layout_marginTop="43dp" 
    android:text="Button" /> 

</RelativeLayout> 
0

使用此代碼:

ImageView image = null; 
Bitmap bm = BitmapFactory.decodeFile("Your image browse");  
image.setImageBitmap(bm);