如何在strings.xml文件中存储android常量?
我想用这样的东西:如何在strings.xml文件中存储android常量?,android,xml,configuration,Android,Xml,Configuration,我想用这样的东西: <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="@string/textview_gravity" > 然后在mystrings.xml中 有这样的东西: <stri
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="@string/textview_gravity" >
然后在mystrings.xml中
有这样的东西:
<string name="textview_gravity" >bottom|right</string>
底部|右侧
有什么想法吗?这可能吗?不可能。您应该使用
style.xml
来处理这类事情不,这是不可能的。您应该使用styles.xml
来处理这类事情我不相信您可以在android中以这种方式使用字符串常量。我相信您只能使用存储在属性字段中的字符串常量,该属性字段需要一个字符串字段,如:
android:text="@string/some_string"
我不相信你可以在android中用这种方式使用字符串常量。我相信您只能使用存储在属性字段中的字符串常量,该属性字段需要一个字符串字段,如:
android:text="@string/some_string"
相应地更改yur代码中的重力。在xml中,我认为这是不可能的。请相应地更改代码中的重力。在xml中,我认为这是不可能的。