2012-03-24 2 views
0

Ich habe den Bildschirm mit diesem relativen Layout entworfen.Machen Sie nicht überlappende Bild-Taste mit relativen Layout

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<AutoCompleteTextView 
    android:id="@+id/EditText01" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" /> 

<ImageButton 
    android:id="@+id/imageButton1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:layout_alignRight="@+id/EditText01" 
    android:src="@android:drawable/ic_notification_clear_all" /> 

<AutoCompleteTextView 
    android:id="@+id/EditText02" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/EditText01" /> 

<ImageButton 
    android:id="@+id/imageButton2" 
    android:layout_width="24dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignTop="@+id/EditText02" 
    android:src="@android:drawable/ic_notification_clear_all" /> 

Welche Änderungen sollte ich tun, damit das Bild richtig auf die automatische Vervollständigung Textfeld ausgerichtet ist. ??
Vielen Dank im Voraus ..
P. S: Da ich den picture.Here nicht den Ruf habe zu laden ist der Link http://i.stack.imgur.com/SRG9W.png

Antwort

0

android:layout_alignRight="@+id/EditText01" bedeutet, dass Ihre Schaltfläche seine rechte Kante will mit dem rechten Rande EditTexts ausgerichtet ist. Was Sie eigentlich wollen, ist, dass die linke Kante der Schaltfläche an der rechten EditTexts-Kante ausgerichtet ist. Das ist android:layout_toRightOf="@+id/EditText01"

bearbeiten - das ist, was Sie wollen, ich denke,

<ImageButton 
    android:id="@+id/imageButton1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:src="@android:drawable/ic_notification_clear_all" /> 

<AutoCompleteTextView 
    android:id="@+id/EditText01" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:layout_toLeftOf="@id/imageButton1" /> 

<ImageButton 
    android:id="@+id/imageButton2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/EditText01" 
    android:src="@android:drawable/ic_notification_clear_all" /> 

<AutoCompleteTextView 
    android:id="@+id/EditText02" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignRight="@+id/EditText01" 
    android:layout_below="@+id/EditText01" 
/> 
Verwandte Themen