【问题标题】:How to achieve no padding between two edittext's underlines如何实现两个edittext下划线之间没有填充
【发布时间】:2016-03-01 06:13:06
【问题描述】:

以下是我当前布局的一部分

<LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginBottom="6dp"
                android:id="@+id/domainContainer"
                android:weightSum="1.0">
                <EditText
                    android:layout_width="wrap_content"
                    android:layout_height="44dp"
                    android:inputType="text|textNoSuggestions"
                    android:id="@+id/txtDomain"
                    android:theme="@style/LoginEditText"
                    android:drawableLeft="@drawable/ic_globe"
                    android:hint="@string/domain"
                    android:layout_marginRight="0dp"
                    android:textColorHint="#4F4F4F"
                    android:paddingRight="0dp"
                    android:textSize="16sp"
                    android:gravity="center_vertical|right" />
                <EditText
                    android:layout_weight="1.0"
                    android:layout_height="44dp"
                    android:paddingLeft="0dp"
                    android:layout_marginLeft="0dp"
                    android:inputType="none|textNoSuggestions"
                    android:id="@+id/txtHostname"
                    android:theme="@style/LoginEditText"
                    android:hint=".mydomain.com"
                    android:textColor="#9E9E9E"
                    android:textSize="16sp"
                    android:clickable="false"
                    android:cursorVisible="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:layout_width="wrap_content"
                    android:layout_marginBottom="6dip"
                    android:gravity="center_vertical|left" />
            </LinearLayout>

我在两个edittexts的文本之间有零填充,但是我如何在两个edittext视图的两个下划线之间实现零填充(即所以它看起来像一条长线下划线)。

【问题讨论】:

    标签: android android-edittext android-styles


    【解决方案1】:

    您可以尝试设置负边距以使 edittext 小部件更接近。请小心,因为您可能会导致重叠。

    android:layout_marginRight="-8dp"
    

    也就是说,我不鼓励您这样做,因为如果有 2 个 edittext 视图看起来是一个,用户可能会感到困惑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-12
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-26
      • 1970-01-01
      • 2022-01-13
      相关资源
      最近更新 更多