android实现多列显示的下拉列表框-Spinner(1)

button1 = (Button) findViewById(R.id.button1);

button2 = (Button) findViewById(R.id.button2);

textView = (TextView) findViewById(R.id.textview);

builder = new Builder(TestAndroid9Activity.this);

builder.setView(layout);

button1.setOnClickListener(new OnClickListener() {

public void onClick(View arg0) {

// TODO Auto-generated method stub

if(dialog == null){

dialog = builder.show();

}

dialog.show();

}

});

gridView.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView<?> arg0, View arg1, int position,

long arg3) {

// TODO Auto-generated method stub

button1.setText(getResources().getStringArray(R.array.city)[position]);

dialog.dismiss();

adapter.map.put(index, false);

adapter.map.put(position, true);

index = position;

adapter.notifyDataSetChanged();

}

});

}

private class MyAdapter extends BaseAdapter{

private Context context;

private String[] citys;

private LayoutInflater inflater;

public HashMap<Integer, Boolean> map;

public MyAdapter(Context context) {

super();

this.context = context;

citys = context.getResources().getStringArray(R.array.city);

inflater = LayoutInflater.from(context);

map = new HashMap<Integer, Boolean>();

for(int i=0;i<citys.length;i++){

map.put(i, false);

}

}

public int getCount() {

// TODO Auto-generated method stub

return citys.length;

}

public Object getItem(int position) {

// TODO Auto-generated method stub

return null;

}

public long getItemId(int position) {

// TODO Auto-generated method stub

return position;

}

public View getView(int position, View view, ViewGroup parent) {

// TODO Auto-generated method stub

if(view == null){

view = inflater.inflate(R.layout.bank_item, null);

}

TextView textView = (TextView) view.findViewById(R.id.list_text);

RadioButton radioButton = (RadioButton) view.findViewById(R.id.radiobutton);

radioButton.setChecked(map.get(position));

textView.setText(citys[position]);

return view;

}

}

bank_grid.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:orientation=“vertical”

android:padding=“20dp”

android:background=“#ffffff”

android:id=“@+id/grid_layout”>

<GridView

android:id=“@+id/grid”

android:layout_width=“fill_parent”

android:layout_height=“fill_parent”

android:verticalSpacing=“20px”

android:horizontalSpacing=“10px”

android:numColumns=“4”

android:scrollbars=“vertical”

android:layout_margin=“10dp”/>

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

img

img

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(资料价值较高,非无偿)

学习交流

群内有许多来自一线的技术大牛,也有在小厂或外包公司奋斗的码农,我们致力打造一个平等,高质量的Android交流圈子,不一定能短期就让每个人的技术突飞猛进,但从长远来说,眼光,格局,长远发展的方向才是最重要的。

35岁中年危机大多是因为被短期的利益牵着走,过早压榨掉了价值,如果能一开始就树立一个正确的长远的职业规划。35岁后的你只会比周围的人更值钱。

《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门即可获取!

造一个平等,高质量的Android交流圈子,不一定能短期就让每个人的技术突飞猛进,但从长远来说,眼光,格局,长远发展的方向才是最重要的。

35岁中年危机大多是因为被短期的利益牵着走,过早压榨掉了价值,如果能一开始就树立一个正确的长远的职业规划。35岁后的你只会比周围的人更值钱。

《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门即可获取!
  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值