我有一个 Spinner,里面只有图像。
我可以在整个微调器上拉伸图像吗?
行.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/country_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"/>
</LinearLayout>
自定义适配器
public View getCustomView(int position, View convertView,ViewGroup parent)
{
LayoutInflater inflater = (LayoutInflater) m_Contex.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.row, parent, false);
ImageView icon = (ImageView) row.findViewById(R.id.country_icon);
icon.setImageResource(m_CountryImages.get(position));
return row;
}