KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a layout with a TextView and I want the android:gravity attribute value to be pulled from another resource file, android:gravity="@???/item_align" , where item_align is the name of a resource in another xml file. The typical values used in a layout, center or bottom or bottom|center_horizontal don't work. What type goes in the @??? , integer works, if I replace the strings with the actual integer value ("center" replaced with 0x011). But, that's not a good solution. So, the question(s): How do I refer to the value in the layout file, and what does the item look like in the resource file? <TextView android:id="@+id/item_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_margin="1dp" android:layout_centerHorizontal="true" android:gravity="@???/item_align" android:text="65" android:textSize="20sp" android:typeface="sans" android:textStyle="bold" android:textColor="#000000" />
Tags (comma-separated)
Save Edits
Cancel