Android spinner使用simple_spinner_item的同时修改字体大小


// 适配器
private ArrayAdapter<String> yearAdapter;

private TextView user;
private Button btn;

Calendar cal = Calendar.getInstance();
String year = String.valueOf(cal.get(Calendar.YEAR));

yearLists = new ArrayList<String>();
yearLists.add(year);
yearAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, yearLists);
yearAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(yearAdapter);
spinner1.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
/* 将所选mySpinner 的值带入myTextView 中 */
/* user.setText("您选择的是:"+ adapter.getItem(arg2)); */
/* 将mySpinner 显示 */
// arg0.setVisibility(View.VISIBLE);
yearIndex = arg2;
}

public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
/* user.setText("NONE"); */
arg0.setVisibility(View.VISIBLE);
}

});

activity_second.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center"    
    android:gravity="center"
    android:orientation="vertical"
    android:background="@drawable/info_bg" >
    
    <TextView 
        android:id="@+id/show"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="100dp"
        android:textSize="50dp"
        android:textColor="#000000"
        android:text="aaa"
        />

    <!-- 学年 -->

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tv01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="40dp"
            android:textColor="#000000"
            android:text="学年" />

        <Spinner
            android:id="@+id/sp01"
            android:layout_width="250dp"
            android:layout_height="70dp"

            android:layout_marginLeft="30dp" />
    </LinearLayout>

    <!-- 考点 -->

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tv02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="40dp"
            android:textColor="#000000"
            android:text="考点" />

        <Spinner
            android:id="@+id/sp02"
            android:layout_width="250dp"
            android:layout_height="70dp"

            android:layout_marginLeft="30dp" />
    </LinearLayout>

    <!-- 专业 -->

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tv03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="40dp"
            android:textColor="#000000"
            android:text="专业" />

        <Spinner
            android:id="@+id/sp03"
            android:layout_width="250dp"
            android:layout_height="70dp"

            android:layout_marginLeft="30dp" />
    </LinearLayout>

    <!-- 确定按钮,跳转到学生信息列表 -->

    <Button
        android:id="@+id/Button01"
        android:layout_width="300dp"
        android:layout_height="80dp"
        android:layout_marginTop="200dp"
        android:background="@drawable/shape"
        android:text="确定"
        android:textColor="#FFFFFF"
        android:textSize="40dp" />

</LinearLayout>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值