Android - 如何在 android studio 中使用 FloatingLabel

标签 android android-studio android-gradle-plugin

我有一个旧项目使用 Floating Label ,当我尝试将这个旧项目导入 android studio 时,我遇到了一些问题

其中一个导入 float 标签库

enter image description here

更新问题

作为我得到的答案,我应该使用 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/

相关文章:

java - 构建 APK 时 Android Studio "MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)"错误

android - 我无法在 android 中显示本地存储中的图像

android - 收到错误 : 'shared_ptr' in namespace 'std' does not name a type

java - 在最新检查期间无法捕获任务 ':checkDevClasspath' 属性 'compileClasspath' 的输入文件的指纹

android - 如何在 Android 模块库中创建 Android 模块库

android - 解码器初始化失败 : OMX. qcom.video.decoder.avc,

android - 通过促销代码进行的应用内购买返回空的开发人员有效负载字符串

java - android.content.ActivityNotFoundException : Unable to find explicit activity class in Android

android - 如何检测用户安装应用程序的唯一设备

android-studio - 构建工具版本android失败