0

I want to add a seperator line between TextView and EditText in Android layout. I have tried this approach to do it but when i use like it works

         <TableRow
                android:id="@+id/frmPaymentTrRemainder"
                style="@style/rounded_row" >
                <TextView
                    android:id="@+id/frmPaymentTvRemainder"
                    style="@style/rounded_label"
                    android:text="Field" />
                <EditText
                    android:id="@+id/frmPaymentEtRemainder"
                    style="@style/rounded_value"
                    android:editable="false"
                    android:ems="10"
                    android:inputType="numberDecimal" />
                <View
                    android:layout_width="2dip"
                    android:layout_height="fill_parent"
                    android:layout_margin="6dp"
                    android:layout_weight="0.1"
                    android:background="#FF909090" />
            </TableRow>

Screenshot1

When i put view between text views like

         <TableRow
                android:id="@+id/frmPaymentTrRemainder"
                style="@style/rounded_row" >

                <TextView
                    android:id="@+id/frmPaymentTvRemainder"
                    style="@style/rounded_label"
                    android:text="Field" />

                <View
                    android:layout_width="2dip"
                    android:layout_height="fill_parent"
                    android:layout_margin="6dp"
                    android:layout_weight="0.1"
                    android:background="#FF909090" />

                <EditText
                    android:id="@+id/frmPaymentEtRemainder"
                    style="@style/rounded_value"
                    android:editable="false"
                    android:ems="10"
                    android:inputType="numberDecimal" />
            </TableRow>

Screenshot2

I just want a 2pix seperator between TextView and EditText. Any help to achieve this challenge would be appreciated.

Community
  • 1
  • 1
hkutluay
  • 6,794
  • 2
  • 33
  • 53

3 Answers3

2

Try to move your divider view after EditText or wrap EditText and View inside a LinearLayout with weights set to 1 and 0 correspondingly.

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
        >
       <View
                android:layout_width="2dip"
                android:layout_height="fill_parent"
                android:layout_margin="6dp"
                android:layout_weight="0"
                android:background="#FF909090" />

    <EditText
            android:id="@+id/frmPaymentEtRemainder"
            style="@style/rounded_value"
            android:editable="false"
            android:ems="10"
            android:layout_weight="1"
            android:inputType="numberDecimal" />


    </LinearLayout>
hkutluay
  • 6,794
  • 2
  • 33
  • 53
k_shil
  • 2,108
  • 1
  • 20
  • 25
0

try to remove the weight attribute

Rotem
  • 1,472
  • 2
  • 11
  • 18
0

Try this :

<ImageView android:layout_width="2dip" android:layout_height="fill_parent" android:background="#FF909090" />

Vincent Ducastel
  • 10,121
  • 2
  • 17
  • 11