Reputation:
I have displayed the resource of the string in the values folder
activity_main.xml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="10dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="140dp"
android:background="@drawable/frame_background_for_rounded_corners_white_bkg" >
<ImageView
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/image_view_background_white_background" />
<Button
android:id="@+id/button1"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:background="@drawable/button_round_cornered_white_background"
android:text="Button" />
<TextView
android:layout_width="wrap_content"
android:layout_height="141dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/button1"
android:gravity="center"
android:text="@string/BuffetOfferings-Breakfast-statement"
android:textColor="#000000"
android:textSize="24sp" />
</RelativeLayout>
</RelativeLayout>
In the values folder
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
<color name="TextColorForTextAboveImage">#FFFFFF</color>
<string name="BuffetOfferings-Breakfast-statement">Tap the "Breakfast" to offer, then the days and time of its offerings to your customers</string>
</resources>
My OUTPUT ::
Clearly you can see instead of text to display .... reference itself is displaying
How to resolve this !
Upvotes: 0
Views: 85
Reputation: 8939
You can't define string in styles.xml
directly instead of you can reference to a String from strings.xml
.
You should define your string in strings.xml and remove '-' use '_'
strings.xml
Use like this
<string name="BuffetOfferings_Breakfast_statement">Tap the "Breakfast" to offer, then the days and time of its offerings to your customers</string>
Hope this help you.
Upvotes: 0
Reputation: 3399
Replace the resource attribute as
<string name="BuffetOfferings_Breakfast_statement">Tap the "Breakfast" to offer, then the days and time of its offerings to your customers</string>
replace hyphen '-' with underscore'_'
Upvotes: 0
Reputation: 9507
You need to remove your Dash(-) from name
attribute.
<string name="BuffetOfferingsBreakfaststatement">Tap the "Breakfast" to offer, then the days and time of its offerings to your customers</string>
For more information read Document.
Upvotes: 0
Reputation: 28589
Your string names need to use _
instead of -
.
<string name="BuffetOfferings_Breakfast_statement"></string>
Upvotes: 1