سؤال

I have the following code:

<LinearLayout 
        android:id="@+id/aceptar_y_rechazar_tu_mesa"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:padding="10dp"
        >
         <ImageView
             android:id="@+id/aceptar_tu_mesa"
             android:layout_width="20dp"
             android:layout_height="20dp"
             android:scaleType="centerInside"
             android:src="@drawable/checked" 
             />
         <ImageView 
             android:id="@+id/rechazar_tu_mesa"
             android:layout_width="20dp"
             android:layout_height="20dp"
             android:scaleType="centerInside"
             android:src="@drawable/menos"
             />

    </LinearLayout>

and visualy is this:

enter image description here

I need separate them, but when I aplly a padding-rigth this happen:

enter image description here What can I do to fix?

هل كانت مفيدة؟

المحلول

Use...

android:layout_marginRight

instead of

android:paddingRight

نصائح أخرى

If you want to separate your images you can follow this

1) Use android:layout_marginRight with respect to Second Image.

<ImageView
         android:id="@+id/aceptar_tu_mesa"
         android:layout_marginRight="10dp"
         .....  />
<ImageView
          android:id="@+id/rechazar_tu_mesa"
          ....../>

2)Use android:layout_marginLeft with respect to First Image.

<ImageView
         android:id="@+id/aceptar_tu_mesa"

         .....  />
<ImageView
          android:id="@+id/rechazar_tu_mesa"
          android:layout_marginLeft="10dp"
          ....../>

3) You can use view in between these two images to separate them

<ImageView
         android:id="@+id/aceptar_tu_mesa"
                      .....  />
<View 
    android:layout_width="10dp"
    android:layout_height="10dp"/>

<ImageView
          android:id="@+id/rechazar_tu_mesa"
          ....../>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top