Skip to content

Commit

Permalink
添加车牌号码选择器demo
Browse files Browse the repository at this point in the history
  • Loading branch information
liyujiang-gzu committed Dec 18, 2016
1 parent ef8d89c commit 96de796
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### v1.3.1 - 2016.12.18
支持设置选中项分割线的宽比例、透明度、粗度;
修复小数选择器设置默认选择项可能无效的bug;
添加中国大陆车牌号码选择器;
### v1.3.0 - 2016.12.15
支持设置选择器主体背景颜色;
所有选择器支持滑动实时监听;
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/cn/qqtheme/androidpicker/NestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Builder:Android Studio
*/
public class NestActivity extends Activity {
private CarNumberPicker picker;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -30,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {

final TextView textView = (TextView) findViewById(R.id.wheelview_tips);
WheelView wheelView = (WheelView) findViewById(R.id.wheelview_single);
wheelView.setItems(new String[]{ "少数民族", "贵州穿青人", "不在56个少数民族之列", "第57个民族"});
wheelView.setItems(new String[]{"少数民族", "贵州穿青人", "不在56个少数民族之列", "第57个民族"}, 1);
wheelView.setTextColor(0xFFFF00FF);
WheelView.LineConfig config = new WheelView.LineConfig();
config.setColor(0xFFFF00FF);//线颜色
Expand All @@ -45,7 +46,7 @@ public void onSelected(boolean isUserScroll, int index, String item) {
}
});

final CarNumberPicker picker = new CarNumberPicker(this);
picker = new CarNumberPicker(this);
picker.setLineConfig(new WheelView.LineConfig(0));
picker.setOffset(3);
picker.setOnWheelListener(new CarNumberPicker.OnWheelListener() {
Expand All @@ -67,4 +68,8 @@ public void onBack(View view) {
finish();
}

public void onCarNumber(View view) {
picker.show();
}

}
8 changes: 8 additions & 0 deletions app/src/main/res/layout/activity_nest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
android:gravity="center_vertical"
android:text="内嵌选择器"/>

<TextView
style="?android:textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:onClick="onCarNumber"
android:text="车牌"/>

</LinearLayout>

<TextView
Expand Down

0 comments on commit 96de796

Please sign in to comment.