android Spinner自定义开发

2025-05-22 08:09:37

1、新建一个android工程,名称SpinnerSelfShow,其他参数可以自己设置,参见下图

android Spinner自定义开发

2、开始对下拉框的样式进行定义,配置布局文件item.xml,里面放入迷撞笸痉两个textview文本显示<?xml version="1.0" encod足毂忍珩ing="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <TextView android:id="@+id/one" android:layout_width="wrap_content" //适应自身宽度 android:layout_height="wrap_content" //适应自身高度 android:drawableLeft="@drawable/icon"//文本左边的图像 android:paddingRight="8dip" //距离左边的距离 android:paddingTop="8dip" //距离屏幕的距离 android:text="TextView" //显示的文本 android:textSize="25sp" /> //设置文本字体 <TextView android:id="@+id/two" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="8dip" android:paddingTop="8dip" android:text="TextView" android:textSize="25sp" /></LinearLayout>

android Spinner自定义开发android Spinner自定义开发android Spinner自定义开发android Spinner自定义开发android Spinner自定义开发
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢