我有一个旧项目使用 Floating Label ,当我尝试将这个旧项目导入 android studio 时,我遇到了一些问题
其中一个导入 float 标签库
更新问题
作为我得到的答案,我应该使用 TextInputLayout
这是我的 float 标签的示例代码
<com.hardik.floatinglabel.FloatingLabelView
android:id="@+id/mob"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip"
android:padding="5dp"
floatview:floatHintText="@string/mob"
floatview:floatHintTextColorFocused="@color/blue"
floatview:floatHintTextColorUnFocused="@color/green"
floatview:floatHintTextStyle="bold"
floatview:textBackground="@drawable/edt_bg" />
如何在 TextInputLayout
中实现相同的结果
最佳答案
Android float 标签在 Android 设计支持库中引入,用于在 EditText 上显示 float 标签。
xml代码
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email" />
</android.support.design.widget.TextInputLayout>
渐变
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
关于Android - 如何在 android studio 中使用 FloatingLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32421999/