Skip to content

Commit

Permalink
bug修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijinjin committed Apr 19, 2018
1 parent 468aaa2 commit afbad1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/zjj/myspinner/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ protected void onCreate(Bundle savedInstanceState) {
//默认单选样式
MySpinner sp_1 = (MySpinner)findViewById(R.id.sp_1);
sp_1.setData(getData());
sp_1.setSelectPositons(new int[]{1});
// sp_1.setSelectPositons(new int[]{1});

//默认多选样式
MySpinner sp_2 = (MySpinner)findViewById(R.id.sp_2);
sp_2.setData(getData());
sp_2.setSelectPositons(new int[]{1,2});
// sp_2.setSelectPositons(new int[]{1,2});

//自定义弹框样式
MySpinner sp_3 = (MySpinner)findViewById(R.id.sp_3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ private void onSure(){
String str = "";
for(int i=0;i<selectData.size();i++){
if(i==0){
str = selectData.get(i).getValue();
str = selectData.get(i).getText();
}else{
str = str +"/"+selectData.get(i).getValue();
str = str +"/"+selectData.get(i).getText();
}
}
this.setText(str);
Expand Down Expand Up @@ -311,7 +311,7 @@ public MySpinner setSelectPositons(int[] posi){
case TYPE_SINGLE:
selectPosition = posi[0];
if(selectPosition<mData.size()){{
this.setText(mData.get(selectPosition).getValue());
this.setText(mData.get(selectPosition).getText());
}}
break;
}
Expand Down

0 comments on commit afbad1c

Please sign in to comment.