package com.geniuseoe.spiner.demo;
import java.util.ArrayList;
import java.util.List;
import com.geniuseoe.spiner.demo.widget.AbstractSpinerAdapter;
import com.geniuseoe.spiner.demo.widget.CustemObject;
import com.geniuseoe.spiner.demo.widget.CustemSpinerAdapter;
import com.geniuseoe.spiner.demo.widget.NormalSpinerAdapter;
import com.geniuseoe.spiner.demo.widget.SpinerPopWindow;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
/**
*
* @author lance
* csdn blog:http://blog.csdn.net/geniuseoe2012
* android-develop group:298044305
*/
public class SpinerWindowDemoActivity extends Activity implements OnClickListener, AbstractSpinerAdapter.IOnItemSelectListener{
/** Called when the activity is first created. */
private View mRootView;
private TextView mTView;
private ImageButton mBtnDropDown;
private List<CustemObject> nameList = new ArrayList<CustemObject>();
private AbstractSpinerAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setupViews();
}
private void setupViews(){
mRootView = findViewById(R.id.rootView);
mTView = (TextView) findViewById(R.id.tv_value);
mBtnDropDown = (ImageButton) findViewById(R.id.bt_dropdown);
mBtnDropDown.setOnClickListener(this);
String[] names = getResources().getStringArray(R.array.hero_name);
for(int i = 0; i < names.length; i++){
CustemObject object = new CustemObject();
object.data = names[i];
nameList.add(object);
}
mAdapter = new CustemSpinerAdapter(this);
mAdapter.refreshData(nameList, 0);
mSpinerPopWindow = new SpinerPopWindow(this);
mSpinerPopWindow.setAdatper(mAdapter);
mSpinerPopWindow.setItemListener(this);
}
@Override
public void onClick(View view) {
switch(view.getId()){
case R.id.bt_dropdown:
showSpinWindow();
break;
}
}
private void setHero(int pos){
if (pos >= 0 && pos <= nameList.size()){
CustemObject value = nameList.get(pos);
mTView.setText(value.toString());
}
}
private SpinerPopWindow mSpinerPopWindow;
private void showSpinWindow(){
Log.e("", "showSpinWindow");
mSpinerPopWindow.setWidth(mTView.getWidth());
mSpinerPopWindow.showAsDropDown(mTView);
}
@Override
public void onItemClick(int pos) {
setHero(pos);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpinerWindowDemo.zip (62个子文件)
SpinerWindowDemo
.project 852B
project.properties 361B
proguard.cfg 1KB
src
com
geniuseoe
spiner
demo
SpinerWindowDemoActivity.java 3KB
widget
NormalSpinerAdapter.java 229B
CustemObject.java 213B
SpinerPopWindow.java 2KB
AbstractSpinerAdapter.java 2KB
CustemSpinerAdapter.java 237B
AndroidManifest.xml 754B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
down_arrow.png 907B
ic_launcher.png 4KB
btn_white_press.9.png 2KB
edittext1.9.png 748B
singleline_item_bg.png 4KB
title_bar.png 12KB
btn_white_nor.9.png 2KB
drawable
selector_btn_white.xml 272B
drawable-mdpi
ic_launcher.png 3KB
layout
spiner_item_layout.xml 549B
spiner_window_layout.xml 604B
main.xml 4KB
values
style.xml 255B
strings.xml 198B
array.xml 466B
.settings
org.eclipse.core.resources.prefs 57B
assets
gen
com
geniuseoe
spiner
demo
BuildConfig.java 167B
R.java 2KB
.classpath 364B
bin
resources.ap_ 30KB
classes
com
geniuseoe
spiner
demo
R$layout.class 501B
R$style.class 427B
R$array.class 417B
BuildConfig.class 359B
R$drawable.class 688B
R$attr.class 361B
widget
CustemObject.class 488B
NormalSpinerAdapter.class 563B
CustemSpinerAdapter.class 592B
AbstractSpinerAdapter$ViewHolder.class 528B
AbstractSpinerAdapter.class 3KB
SpinerPopWindow.class 3KB
AbstractSpinerAdapter$IOnItemSelectListener.class 322B
SpinerWindowDemoActivity.class 4KB
R$id.class 798B
R.class 690B
R$string.class 448B
AndroidManifest.xml 754B
dexedLibs
annotations-2a37388f62495922ce0006a5c5bbc45b.jar 943B
jarlist.cache 119B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
down_arrow.png 115B
ic_launcher.png 4KB
btn_white_press.9.png 2KB
edittext1.9.png 958B
singleline_item_bg.png 994B
title_bar.png 10KB
btn_white_nor.9.png 2KB
drawable-mdpi
ic_launcher.png 2KB
SpinerWindowDemo.apk 37KB
classes.dex 12KB
共 62 条
- 1
蓝斯
- 粉丝: 1301
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页