4

I'm doing some parsing of Android's XML layout files. I'd like to reference Android's XML string constants rather than define my own. I can find the integer constants easily, just not the XML constants.

Where are these string constants located?

Update:

I'm looking for a literal string referencing values like android:LinearLayout, android:layout_gravity, android:layout_width and any values associated with those attributes such as match_parent, center etc.

William Morrison
  • 10,953
  • 2
  • 31
  • 48

1 Answers1

0

did you mean you want to get string from string.xml file?

you can get it with

String get = this.getResources().getString(R.string.string_name);
  • No, I'm looking for where XML string constants for things like `android:layout_gravity` are stored, and constants for the value associated with gravity (`center`, `left`, `right`, etc.) – William Morrison May 09 '14 at 04:04
  • i think all xml constants are store separately in Java class, like when you want to get the gravity, you can use Gravity.CENTER, or when you want to use the parameter for layout size, you can use LayoutParams.FILL_PARENT or LayoutParams.WRAP_CONTENT. – Na Felix Wimpy Wijaya May 09 '14 at 04:12
  • 1
    Right, that's what I mean by integer constants in my question. I don't need those. I need the corresponding XML string for those integer constants. – William Morrison May 09 '14 at 04:14
  • i see it more clearer now. so you want to get "function name" of xml, instead of the value isn't it? what are you going to do with that? are you going to generate a new xml file? I don't know how can we get any "function name" instead of the value. – Na Felix Wimpy Wijaya May 09 '14 at 05:07
  • I'm using it to generate cross platform UI. This means I need to parse the XML file, and so need these XML values. – William Morrison May 09 '14 at 14:00