2011-07-25 70 views
0

Android應用中,我從Android相機返回其設置爲ImageView像一個位圖:放的TextView上的ImageView

bitmap = android.provider.MediaStore.Images.Media 
         .getBitmap(cr, selectedImage); 
         image.setImageBitmap(bitmap); 

進一步我想提出一個TextView這個圖像上,之後保存它的website.Someone作爲回答有關這一主題的另一個問題提出來做到這一點在我的xml:

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

<ImageView 
    android:id="@+id/imageview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scaleType="center" 
    /> 
<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> 

那麼這個問題是TextView的不會在那裏當我保存的圖像和將其上傳到網站!!!!我假設這只是爲了p磨砂的屏幕。 無論如何,如果有人可以幫助我,我會很感激它。謝謝!

回答

3

既然你可以訪問位圖,你可以使用Canvas與位圖,並直接在其上描繪塞入:

Canvas c = new Canvas(theBitMap); 

後,你可以將位圖繪製文本與各種帆布方法。 例如

c.drawText("My Text", xCoord, yCoord, paintObj); 

查看Canvas API瞭解更多信息。

+0

誰是paintObj? – adrian

+0

Paint p = new Paint(); 只是您創建的Paint對象,您可以在其中設置各種標誌,例如抗鋸齒,顏色等 – Tomas