簡體   English   中英

表布局中的微調器與EditText不對齊

[英]Spinner in table layout does not align with EditText

我的XML文件在下面。 我不知道出了什么問題,並且在綁定數據源時使微調器無法對齊。 數據加載之前對齊即可。 我正在將數據加載到下面的TableLayout中。 關於什么可能導致此的任何想法?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="onetech.smartsurvey.acStudent"
android:id="@+id/rl_student">

<LinearLayout
    android:id="@+id/ll_student"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >


    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tl_student"
        android:orientation="horizontal"
        >

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/tr_student1"
            android:layout_margin="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="IC/Passport"
                android:id="@+id/tv_icPassport"
                android:textSize="16dp" />

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/et_icPassport"
                android:ems="10"
                android:layout_column="2"/>
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/tr_student2"
            android:layout_margin="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Nama"
                android:id="@+id/tv_StudentName"
                android:textIsSelectable="false"
                android:textSize="16dp" />

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/et_studentName"
                android:ems="10"
                android:layout_column="2" />
        </TableRow>

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/tr_student3"
            android:layout_margin="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Telefon"
                android:id="@+id/tv_phone"
                android:textSize="16dp" />

            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/et_phone"
                android:ems="10"
                android:layout_column="2"/>
        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/tr_student4"
            >


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Lokasi"
                android:id="@+id/tv_location"
                android:textSize="16dp" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/spnr_location"
                android:spinnerMode="dropdown" />

        </TableRow>
    </TableLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="244dp"
        android:layout_height="83dp"
        android:layout_gravity="right">

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ibtn_OK"
            android:focusableInTouchMode="false"
            android:src="@drawable/ok"/>

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ibtn_Reset"
            android:focusableInTouchMode="false"
            android:src="@drawable/reset"/>
</LinearLayout>
</LinearLayout>

嘗試這個,

android:dropDownWidth="match_parent"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM