小编Er.*_*pat的帖子

通过数据绑定中的变量标签设置文本大小

我想通过布局标签中的变量标签将我的编辑文本大小更改为数据绑定,但我无法设置正确的大小。

我在这里添加了我的自定义编辑文本布局,我也在粘贴我的布局,所以请指导我在布局中使用此编辑文本时如何设置动态文本大小。

这是自定义编辑文本布局,我在其中声明了 textSize 变量并且类型为 Float

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <import type="android.text.InputType" />
        <variable name="textSize" type="Float" />
        <variable name="inputType1" type="Integer" />
        <variable name="visibility" type="Boolean" />
        <variable name="textColor" type="Integer" />
        <variable name="holderColor" type="Integer" />
        <variable name="hintColor" type="Integer" />
        <variable name="holderText" type="String" />
        <variable name="hintText" type="String" />
        <variable name="holderVisibility" type="Boolean" />
        <variable name="leftIcon" type="android.graphics.drawable.Drawable" />
        <variable name="editTextBottomLine" type="android.graphics.drawable.Drawable" />
        <variable name="rightIcon" type="android.graphics.drawable.Drawable" />   
        <variable name="fontStyle" type="Integer" />
        <variable name="textField" type="androidx.databinding.ObservableField&lt;String&gt;" />   
        <variable name="isTypePhoneNo" type="Boolean" />
        <variable name="contentMaxLength" type="Integer" />
        <variable name="emojiVisibility" …
Run Code Online (Sandbox Code Playgroud)

android android-databinding

5
推荐指数
1
解决办法
1864
查看次数

标签 统计

android ×1

android-databinding ×1