繁体   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