I have to get my data by running a query. So, I need a TextView that can add data dynamically.Here is my code to get and allocate data dynamically in a TextView
do{
int count = cursor.getCount();
final TextView[] myTextViews = new TextView[count];
for(int counter = 0; counter<count ; counter++){
getName = cursor.getString(cursor.getColumnIndexOrThrow("NAME"));
affiliation_ID = cursor.getString(cursor.getColumnIndexOrThrow("NUMBER"));
final TextView rowTextView = new TextView(this);
rowTextView.setText(Html.fromHtml(getName+"<sup><small>"+affiliation_ID+"</small></sup><br/>"));
rel.addView(rowTextView);
}
} while(cursor.moveToNext());
It gives me result like this.
As you can see One word overlapping with another words. Here is my xml file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/ConTopic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/ConTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/ConTopic"
android:layout_marginTop="22dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RelativeLayout
android:id="@+id/rel"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
</RelativeLayout>
</RelativeLayout>
</ScrollView>
So, I need to know or my question is
1) If I want to show those text under ConTitle
. What should I suppose to do ?
2) For case 1, How can I dynamically add desire position of a TextView and Size of a Text.
3)If I want to add another simple Texview(normal text) under dynamically added TextView.how can I do that ?
And the last thing, This is what I want achieve