利用XML布局自定义列表样式
之前在学习Spinner 的时候就有这样的困惑,我们是不是可以自己定义列表的样式呢。因为我们使用系统自定义的样式的话有可能和我们的布局格格不入,显示的字样有可能很大很大。今天我们就来学习一下利用XML加适配器来自定义一个列表样式。不过在这里我们是以ListView为例效果是和Spinner一样的有些疑惑的小伙伴可以自己再去尝试一下给Spinner自定义一下列表样式。
首先我们写一个XML,作为整体的框架布局main_linearlayout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/tv_content"
android:textSize="40sp"
android:textStyle=