我正在尝试做这样的事情:
如您所见,Login
标签应与徽标图像相交。我试过这样的布局:
<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>
但当然,布局并不相互交叉。有可能解决吗?也许有办法设置负间隔..
答案 0 :(得分:2)
是的,在您的布局中,您使用线性布局作为基础,然后可以设置负间隔,如下所示,
<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>
........
答案 1 :(得分:0)
就这样
<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>