1. I had just made my own layout in R/layout as mylist.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="7pt"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:textColor="@android:color/black"
android:gravity="center"/>
2.and then i changed my main.xml to show a listview. like,
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/my_list"/>
</LinearLayout>
And at last i have my activity file like
// all the stuff
// i cant put my code here,na?:)
//Its simple. just change layout to ours
ListView list;
list = (ListView)findViewById(R.id.my_list);
ArrayAdapter<CharSequence> list_adapter= ArrayAdapter.createFromResource(
this, R.array.my_array, R.layout.mylist);
my_list.setAdapter(list_adapter);
No comments:
Post a Comment