2015-08-03 76 views

回答

0

該請求的一般層次結構模式是:

<FrameLayout android:width="match_parent" 
      android:height="match_parent"> 

    <EditText android:width="match_parent" 
       android:height="match_parent" /> 

    <ImageView android:width="wrap_content" 
       android:height="wrap_content" 
       android:margin="5dp" 
       android:src="@drawable/ic_attach" 
       android:layout_gravity="right|bottom" /> 
</FrameLayout> 
0

在一個相對佈局試試這個:

<EditText 
    android:id="@+id/edit_text" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:lines="5" /> 

<ImageView 
    android:layout_alignBottom="@+id/edit_text" 
    android:layout_alignRight="@+id/edit_text" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/attach"/> 
0

我想直接的不可能的EditText但你可以爲此做一些技巧。 請參閱下面的代碼,它可能會幫助你。

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 

    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="top|left" 
     android:minLines="10" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:src="@drawable/ic_launcher" /> 
</RelativeLayout>