Android Multiline labels


#1

I need to create a cartesian chart (for Android) in which the first label will be displayed in the first line,
the second label will be displayed in the second line, the third label in first line and so on.

When i add the “\n” between the characters of a String the result is to split the String in two lines, 
but if the addition was at the start of the string, the string is not represented in the second line.

What’s the problem? Is like the library does not recognize the \n in start of a string

Thanks in advance :D 


#2

Hello St4B

Thanks for getting in touch.

I have had a quick go at achieving the ‘staggered’ appearance of tick labels as you describe and I was successful in using \n to push the label on to the second line.

Can you please provide a code snippet with your command which includes the \n?

I look forward to hearing from you.

Thanks,

Kai.


#3

Problem solved! 
The code was something in form of:

if(i%2 == 0)
    adapter.add(new DataPoint<String,Double>("\n\n" +“Label”,value);

else
    adapter.add(new DataPoint<String,Double>(“Label”,value);

The solution was to add (char)160 in front of \n:

    adapter.add(new DataPoint<String,Double>((char)160 + “\n\n” +“Label”,value);