Android之怎么自定义ListView样式
Android之如何自定义ListView样式
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff9900" >
</TextView>
ListAdapter adapter =
ArrayAdapter.createFromResource(
this, R.array.ctype,R.layout.listview_item);
R.layout.listview_item使用自定义的TextView样式
如何自定义ListView呢?
ListView只是一个容器
ListView的里面包含的每个小项其实是一个个TextView
定义ListView样式其实是定义每个TextView样式
我们也可以自定义每行布局
(见截图)
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff9900" >
</TextView>
ListAdapter adapter =
ArrayAdapter.createFromResource(
this, R.array.ctype,R.layout.listview_item);
R.layout.listview_item使用自定义的TextView样式
版权声明:本文为博主原创文章,未经博主允许不得转载。