0

I'm working on a Xamarin Android App using axml views. One of the views requires that the textview on one view be configurable from the server. For example setting the font, being able to use bullet points and so on. Any recommendations for packages for ideas on how to accomplish this? Below is the axml :

                <TextView
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:layout_width="fill_parent"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="10dp"
                    android:textColor="@android:color/black"
                    android:layout_height="fill_parent"
                    android:layout_gravity="left"
                    android:id="@+id/ParagraphTextView" />

Just looking for idea's on how to make this possible.

Akeshwar Jha
  • 4,516
  • 8
  • 52
  • 91
yams
  • 942
  • 6
  • 27
  • 60

1 Answers1

1

Well this depends what you mean by configurable.

In code you can for instance call:

Typeface type = Typeface.CreateFromAsset(GetAssets(),"fonts/Roboto.ttf"); 
paragraphTextView.SetTypeface(type);

Assuming your fonts are in your assets folder. If you don't have them you'll have to manage downloading them and storing them and getting the font asset from wherever you store it.

For bullet points you could maybe try HTML via:

var myText = "&#8226; An item with a bullet before it<br/>"
paragraphTextView.SetText(Html.FromHtml(myText));

For more bullet ideas see: How to add bulleted list to android application?

Community
  • 1
  • 1
egfconnor
  • 2,637
  • 1
  • 26
  • 44
  • The font portion I've got an idea on but what I'm really looking for is the being able to do the bullet point, or dashes. I guess I could contain the html value for bullet points in the server.. – yams Jul 01 '16 at 15:56
  • You can accomplish it in a variety of ways. Multiple text views for each line with one for the bullet and then the text, one text view with multiple lines like I showed you, etc. It all depends on your use case. – egfconnor Jul 01 '16 at 17:33
  • I kind of like the idea of having mulitple textviews. – yams Jul 05 '16 at 15:59