Moving images and text

I am trying to do something like this:

enter image description here

As you can see, the label Login

should intersect with the logo image. I've tried a layout like this:

<LinearLayout
    style="@style/fullWidth"
    android:background="@drawable/login_logo" />

<LinearLayout
    style="@style/fullWidth"
    android:orientation="vertical">

    <LinearLayout style="@style/labeledFieldLayout">
        <TextView style="@style/labeledFieldLabel"
                  android:text="@string/common_email"/>
        <EditText style="@style/labeledField_EditEmail"
                  android:id="@+id/emailEditor" />
    </LinearLayout>

........
</LinearLayout>

      

But, of course, the layouts do not overlap with each other. Can you decide? Maybe there is a way to set negative intervals.

+3


source to share


2 answers


Yes. In your layout you are using linear layout as base, then negative spacing can be set as shown below,

<LinearLayout
style="@style/fullWidth"
android:background="@drawable/login_logo" />

      



<LinearLayout style="@style/labeledFieldLayout"  android:layout_marginTop="-30dp">
    <TextView style="@style/labeledFieldLabel"
              android:text="@string/common_email"/>
    <EditText style="@style/labeledField_EditEmail"
              android:id="@+id/emailEditor" />
</LinearLayout>

      

........

+2


source


Just like

<LinearLayout
style="@style/fullWidth" android:layout_gravity="center_horizontal"
android:background="@drawable/login_logo" /></LinearLayout>

      



<LinearLayout style="@style/labeledFieldLayout" >

    <TextView
        style="@style/labeledFieldLabel"
        android:text="@string/common_email" />

    <EditText
        android:id="@+id/emailEditor"
        style="@style/labeledField_EditEmail" />
</LinearLayout>

      

0


source







All Articles