1

我想使用 android native 创建一个如下图所示的 EditText android.support.design.widget.TextInputLayout

更清楚地提示应该以多行显示。

图片

我试过\nstring.xmllike中添加转义字符

<string name="mobile_comp">Mobile Number \n (For chat...)</string>

EditText当我放在里面时它似乎不起作用TextInputLayout。所以有人知道我在这里做错了什么吗?我上网但找不到原因?

代码

 <android.support.design.widget.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginBottom="@dimen/text_input_margin"
                            android:layout_marginTop="@dimen/text_input_margin">

                            <com.ribbnapp.ribbn.views.EditText
                                android:id="@+id/mobile"
                                style="@style/EditText"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/edit_text_height"
                                android:layout_marginRight="80dp"
                                android:drawableLeft="@drawable/ic_mobile_number2"
                                android:drawablePadding="@dimen/drawable_padding"
                                android:hint="@string/mobile_comp"
                                android:imeOptions="actionDone"
                                android:inputType="phone"
                                android:maxLength="10"
                                android:singleLine="true"
                                android:textAppearance="?android:textAppearanceSmall" />
                        </android.support.design.widget.TextInputLayout>

Gradle 依赖项

 // App common
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.1.0'
    compile 'com.android.support:cardview-v7:23.1.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile "com.daimajia.swipelayout:library:1.2.0@aar"
    // Facebook SDK
    compile 'com.facebook.android:facebook-android-sdk:4.+'
4

0 回答 0