Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我的图像视图未对齐edittextfield的左侧_Android_Android Layout - Fatal编程技术网

Android 我的图像视图未对齐edittextfield的左侧

Android 我的图像视图未对齐edittextfield的左侧,android,android-layout,Android,Android Layout,下面是我的xml代码我的imageview没有显示在edittext的左侧知道为什么吗??????右侧图像视图将显示,但左侧图像视图在屏幕上不可见 <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:padd

下面是我的xml代码我的imageview没有显示在edittext的左侧知道为什么吗??????右侧图像视图将显示,但左侧图像视图在屏幕上不可见

       <RelativeLayout 

android:layout_width="wrap_content"
android:layout_height="wrap_content" >


     <ImageView
    android:id="@+id/imageView1"
    android:padding="5dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"



 android:layout_alignLeft="@+id/editText1"
    android:src="@drawable/ic_launcher" />


<EditText
    android:id="@+id/editText1"
    android:layout_width="fill_parent"

    android:layout_height="wrap_content"
    android:layout_centerVertical="true" >

</EditText>
 <ImageView
    android:id="@+id/imageView1"
    android:padding="5dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/editText1"
    android:layout_alignBottom="@+id/editText1"
    android:layout_alignRight="@+id/editText1"
    android:src="@drawable/ic_launcher" />




试试这个

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

     <ImageView
        android:id="@+id/imageView1"
        android:padding="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:src="@drawable/ic_launcher"
        android:layout_centerVertical="true" />
     <ImageView
        android:id="@+id/imageView2"
        android:padding="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />
<EditText
    android:id="@+id/editText1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/imageView1"
    android:layout_alignLeft="@+id/imageView2"
    android:layout_centerVertical="true" />



对于第一个ImageView,没有id为editText1的EditText;对于第二个ImageView,android:layout\u alignTop=“@+id/editText1”android:layout\u alignBottom=“@+id/editText1”这两个选项您都无法给出。移除对齐底部看看@tsp answer,你的编辑文本占据了你的整个屏幕大小,因此,您的ImageView可能隐藏在您的EditText下面。请Edy我的相对布局我希望ImageView EditText ImageView位于1行当我在EditText宽度上换行时,它位于屏幕右侧请设置我的整个相对布局It’s help但left ImageView显示在edittest内部我希望left ImageView显示edittex的左侧不在内部edittextfirstimageview显示内部edittext我想显示edittext的左侧
  <RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/imageView1" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:padding="5dp"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@id/editText1"
        android:padding="5dp"
        android:src="@drawable/ic_launcher" />
</RelativeLayout>
<RelativeLayout 
android:layout_width="wrap_content"
android:layout_height="wrap_content">

     <ImageView
        android:id="@+id/imageView1"
        android:padding="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:src="@drawable/ic_launcher"
        android:layout_centerVertical="true" />
     <ImageView
        android:id="@+id/imageView2"
        android:padding="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />
<EditText
    android:id="@+id/editText1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/imageView1"
    android:layout_alignLeft="@+id/imageView2"
    android:layout_centerVertical="true" />
<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:padding="5dp"
    android:src="@drawable/ic_launcher" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@+id/imageView2"
    android:layout_toRightOf="@+id/imageView1"
    android:layout_centerVertical="true"
     >
</EditText>

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_height="wrap_content"

    android:src="@drawable/ic_launcher" />