我試圖在線性佈局中垂直和水平居中放置一個edittext,但它不起作用。真的很簡單的問題。需要幫助將線條佈局中的EditText對齊
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/login">
<EditText
android:layout_width="150dp"
android:layout_height="wrap_content"
android:background="@drawable/loginbutton"
android:text="Username"
android:layout_gravity="center"
android:textSize="25dp"
android:gravity="center_horizontal|center_vertical"
android:textColor="#000000"
android:layout_margin="10dp"
android:id="@+id/username">
</EditText>
我會在同時嘗試更改爲相關佈局。
感謝您的信息! – codesomethin
現在我怎麼能在屏幕上居中顯示3個?因爲我將其中一個放在下面,但它看起來很傻。我需要全部3箇中心,就像他們在一個視圖中一樣,我將這個視圖集中在父視圖中。有任何想法嗎? – codesomethin
只居中其中一個,然後在另外兩個標籤上僅使用水平居中使用上面和下面的標籤。 – blindstuff