2013-07-16 100 views
1

我是新來的android。當用戶點擊它時,我需要在畫布上添加文本。編輯文本應該彈出,當用戶完成編輯時,edittext中的文本與imageview位圖結合在一起。我需要幫助獲取editview上的edittext,其中用戶可以輸入text.I也需要能夠走動的ImageView的在Android的畫布上添加EditText

+1

你到目前爲止試過了什麼?你卡在哪裏?我們注意到在這裏爲你寫代碼;) – Guian

+0

嗨,我只需要知道如何添加editText在imageview.I知道如何添加文本到一個職位編程。我只需要知道,如何通過UI。 – user2586488

回答

-1

編輯文本,你可以把一個視圖在另一個是把它們放在一個FrameLayout

就像這個例子方式:

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mainlayout" 
android:layout_height="math_parent" 
android:layout_width="math_parent" /> 

     <ImageView 
     android:id="@+id/textView2" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:src="@drawable/yourDrawable"/> 

     <EditText 

       android:id="@+id/EditText1" 
       android:layout_height="50dp" 
       android:layout_width="200dp" 
       android:layout_marginTop="100dp" 
       android:layout_marginLeft="70dp" 
       android:text="" 
       android:textsize="15dp" /> 

</Framelayout> 

如在此看到blog post

如您所見,我使用邊距將EditText放置在圖像上。

 android:layout_marginTop="100dp" 
     android:layout_marginLeft="70dp"