Android 如何在布局过程中使用自定义LayoutFlater修改字符串资源?

Android 如何在布局过程中使用自定义LayoutFlater修改字符串资源?,android,encryption,layout-inflater,Android,Encryption,Layout Inflater,我想在my strings.xml中存储加密字符串: <string name="secret">ENCRYPTED_STRING</string> 加密的\u字符串 并在文本视图中使用该加密字符串: <TextView android:id="@+id/label" android:orientation="vertical" android:layout_width="match

我想在my strings.xml中存储加密字符串:

<string name="secret">ENCRYPTED_STRING</string>
加密的\u字符串
并在文本视图中使用该加密字符串:

    <TextView
            android:id="@+id/label"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="3dp"
            android:gravity="center_horizontal"
            android:textSize="11sp"
            android:enabled="false"
            android:text="@string/secret"
    >
    </TextView>

并在TextView的布局膨胀期间自动解密加密字符串


通过使用某种类型的自定义LayoutFlater,这是否可行?可能还有一个自定义属性?

这些字符串是只读的,可能您想要
SharedReferences
我不建议修改xml中的字符串。如果要编写自定义LayoutInflater对其进行解密,为什么不直接用Java获取字符串,对其进行解密,然后在TextView上设置文本,而不是尝试在XML中设置文本?@Tanis.7x是的,这是一种方法。但我想知道如何在布局膨胀期间也做到这一点。@pskink在参考页面上几乎没有什么内容。没有关于Factory2如何实施的例子。我正在寻找一个答案,说明如何在布局之前使用它来完成对字符串的解密。