我正在尝试在android代码中创建下面显示的模板,任何人都可以帮我做到这一点,
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:hint="Password"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:background="@color/blue">
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="130dp"
android:text="Login In"
android:textStyle="normal"
android:textSize="15dp"
android:textColor="@android:color/white"
android:background="@color/blue"/>
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Sign Up"
android:textStyle="normal"
android:textSize="15dp"
android:textColor="@android:color/white"
android:background="@color/blue"/>
</LinearLayout>
<LinearLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
</RelativeLayout>
上面是我为实现此目的而编写的代码,但看起来我做错了,谁能帮助我理解这一点。
android:layout_centerHorizontal="true"
在您的linearLayout中添加
<LinearLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句