TableLayout을 아래 내 활동 파일입니다, 나는뿐만 아니라 전체 화면의 테이블 레이아웃의 배경 이미지를 추가하는 화면의 중앙에있는 테이블 레이아웃을 보여주고 싶었다
화면의 중간에 그것을 보여주는, 어떻게해야하는지 알려주세요.
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="User Name: "
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/txtUname"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</EditText>
</TableRow>
<TableRow>
<TextView
android:text="Password: "
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/txtPwd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:password="true">
</EditText>
</TableRow>
<TableRow>
<Button
android:text="Cancel"
android:id="@+id/btnCancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
<Button
android:text="Login"
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
</TableRow>
</TableLayout>
감사합니다,
근무 코드 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/loginbackmain"
android:gravity="center">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher"
android:id="@+id/userDp"/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:background="@drawable/loginformback"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="User Name: "
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/txtUname"
android:layout_width="fill_parent"
android:paddingLeft="5dp"
android:layout_height="wrap_content">
</EditText>
</TableRow>
<TableRow>
<TextView
android:text="Password: "
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/txtPwd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:password="true">
</EditText>
</TableRow>
<TableRow>
<Button
android:text="Cancel"
android:id="@+id/btnCancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
<Button
android:text="Login"
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
</TableRow>
</TableLayout>
</LinearLayout>
코드를 선형 레이아웃에 넣으면됩니다. android : gravity = "center"를 linearlayout에 추가하고 TableLayout의 layout_height = "wrap_content"를 –
부모 레이아웃 (TableLayout)에 안드로이드 : gravity = "center" – Dhina
@Dhina android : 중력 = "center"to parent layout tablerow 중심으로 만들지 만 표 레이아웃에 대한 배경 이미지 만 만족시키지 않습니다. –