So I want to put divider after Location text that way my text will be more visible and clear. I would like to put Name in Bold too, so if someone can help me with this I would appreciate. Here is my code:
TextView textView = (TextView) findViewById(R.id.textView1);
textView.setMovementMethod(new ScrollingMovementMethod());
StringBuffer buffer = new StringBuffer();
String NEW_LINE = "\n";
for(RssMsg rssMsg : gfR.getFeeds()) {
buffer.append("Name : " +rssMsg.getName());
buffer.append(NEW_LINE);
buffer.append(" Date : " +rssMsg.getDate());
buffer.append(NEW_LINE);
buffer.append(" Time : " +rssMsg.getTime());
buffer.append(NEW_LINE);
if(rssMsg.getEventResult() == null){
buffer.append(" EventResult : Unavailable");
}else{
buffer.append(" EventResult : " +rssMsg.getEventResult());
}
buffer.append(NEW_LINE);
buffer.append(" DateRevised : " +rssMsg.getDateRevised());
buffer.append(NEW_LINE);
buffer.append(" EventType : " +rssMsg.getEventType());
buffer.append(NEW_LINE);
buffer.append(" Location : " +rssMsg.getLocation());
buffer.append(NEW_LINE);
buffer.append(NEW_LINE);
}
textView.setTextColor(Color.parseColor("#FFDD00"));
textView.setBackgroundColor(Color.parseColor("#003767"));
textView.setText(buffer.toString());
}
and XML file:
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:id="@string/title_activity_baseball"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.athletic_project.java.Baseball">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:maxLines="80"
android:scrollbars="vertical"
android:layout_marginTop="10dp"
android:text="@string/title_activity_baseball"
android:textSize="15sp"/>
</RelativeLayout>
No comments:
Post a Comment