Skip to content Skip to sidebar Skip to footer

How To Use Symbols

I have to show details in below format, and my JSON looks like this: { 'clubs':[ { 'title' : 'Bold Eyes Night Club', 'description' : '(Headi

Solution 1:

Since you have control over JSON, try to reconstruct JSON like below

{
    "clubs": [
        {
            "title": "Bold Eyes Night Club",
            "description": [
                {
                    "Heading": "Why We Like It",
                    "Points": [
                        "Cook up your own food in the fully equipped kitchens.",
                        "Up the streets London Bridge.",
                        "Famous food shopping market few steps away from the door."
                    ]
                },
                {
                    "Heading": "Need to Know",
                    "Points": [
                        "All rooms to fit two people.",
                        "18+ to book a room."
                    ]
                }
            ]
        }
    ]
}

After Parsing, while setting to TextView.

mHeading.setText(data.getHeading()) // "Why We Like It",
mHeading.setTextSize(24);

String mPoints = ""; mPoint1 +  + 
for(int i = 0; i < data.getPoints().size(); i++)
{
    mPoints = "&emsp;&middot;" + data.getPoints().get(i) + "\n";
}
mPointsTextView.setText(Html.fromHtml(mPoints));

Or you can add symbols from your server, so you can have more control.

{
    "clubs": [
        {
            "title": "Bold Eyes Night Club",
            "description": [
                {
                    "Heading": "Why We Like It",
                    "Points": "&emsp;&middot;Cook up your own food in the fully equipped kitchens.\n &emsp;&middot;Up the streets London Bridge.\n &emsp;&middot;Famous food shopping market few steps away from the door."
                },
                {
                    "Heading": "Need to Know",
                    "Points": "&emsp;&middot;All rooms to fit two people.\n&emsp;&middot;18+tobookaroom."
                }
            ]
        }
    ]
}


mHeading.setText(data.getHeading()) // "Why We Like It",
mHeading.setTextSize(24);

mPointsTextView.setText(Html.fromHtml(mPoints));  //&emsp;&middot;Cook up yo...

Solution 2:

You can make dots like this:

Within Layout:

<View android:layout_width="15dp"
        android:layout_height="15dp"
        android:background="@drawable/back"
        android:layout_alignParentTop="true"
        android:layout_margin="10dp"
        />

Within drawable:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval"  >
            <solid android:color="#ffaabb"/>

        </shape>
        </item>>

</selector>

Output:

Result


Solution 3:

try assci code for this

textView.setText("\u2022 this is DOT"); 
textView.setText("\u00B7 this is MIDDLE DOT"); 
textView.setText("\u000A this is new line"); 

Solution 4:

Android-fonts doesnt support all unicode symbols. So assign your view/control the DejaVuSans.ttf - Font. This font supports all symbols.

Example:

Typeface unicodeFont = Typeface.createFromAsset(getAssets(), "DEJAVUSANS.TTF");
yourView.setTypeface(unicodeFont); 

Hope this helps you

Greets!


Post a Comment for "How To Use Symbols"