YangsBryant / Teapickerview
数据级联选择器、层级结构、多数据筛选、必藏 (Data Cascade Selector, Hierarchical Structure, Multiple Data Screening, Must Star)
Stars: ✭ 139
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Teapickerview
SPPickerView
这是一个选择器,功能类似系统的UIPickerView,但是比UIPickerView的适用范围广得多
Stars: ✭ 28 (-79.86%)
Mutual labels: pickerview
Wheelpicker
A smooth, highly customizable wheel view and picker view, support 3D effects like iOS. 一个顺滑的、高度自定义的滚轮控件和选择器,支持类似 iOS 的 3D 效果
Stars: ✭ 684 (+392.09%)
Mutual labels: pickerview
APJTextPickerView
APJTextPickerView is simple implementation for UITextField to use as UIPickerView and UIDatePicker.
Stars: ✭ 21 (-84.89%)
Mutual labels: pickerview
CountryPickerView
A simple country code picker on iOS, support chinese,english,spanish,national flag,ISO 3166-1 and calling code.(一个简洁的iOS国家代码选择器,支持中文、英语、西班牙语、国旗、ISO 3166-1、国际电话区号) your can search the ISO 3166 code,calling code or country name,the picker view will refresh automatically according to the content of your search.(你可以搜索ISO 3166码,电话区号或者国家名字,pikerView将会…
Stars: ✭ 26 (-81.29%)
Mutual labels: pickerview
XPopupExt
XPopup扩展功能库,基于XPopup强大的弹窗能力和PickerView的选择器逻辑,封装了时间选择器弹窗、城市选择器弹窗和条件选择器。
Stars: ✭ 248 (+78.42%)
Mutual labels: pickerview
Agcircularpicker
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter
Stars: ✭ 592 (+325.9%)
Mutual labels: pickerview
LGApplications
个人小demo集合:①ActionSheet; ②PickerView; ③ScrollView嵌套; ④渐变文字Label; ⑤tableView实现单选;
Stars: ✭ 36 (-74.1%)
Mutual labels: pickerview
Pickerview
One very very user-friendly Picker library(内部提供两种常用类型的Picker:时间选择器(支持聚合)和联动选择器(支持不联动)。支持扩展自定义Picker。支持自定义弹窗。支持作为view的非弹窗场景。)
Stars: ✭ 516 (+271.22%)
Mutual labels: pickerview
TTADataPickerView
A Swift picker view allow you to pick the titles you want and the date, time or dateTime in one view
Stars: ✭ 35 (-74.82%)
Mutual labels: pickerview
Pgdatepicker
日期选择器,支持年、年月、年月日、年月日时、年月日时分、年月日时分秒、月日、月日时、月日时分、月日时分秒、时、时分、时分秒、分秒、月日周 时分等
Stars: ✭ 998 (+617.99%)
Mutual labels: pickerview
RPicker
Simple and Easy-to-Use iOS Swift Date and Options Picker
Stars: ✭ 130 (-6.47%)
Mutual labels: pickerview
Horizontalpicker
A HorizontalPicker view for android, which supports both text and icon. ✨
Stars: ✭ 356 (+156.12%)
Mutual labels: pickerview
Android Dial Picker
A custom rotating dial like picker for android
Stars: ✭ 56 (-59.71%)
Mutual labels: pickerview
Alerts And Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
Stars: ✭ 5,267 (+3689.21%)
Mutual labels: pickerview
TeaPickerView
引入module
allprojects {
repositories {
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
implementation 'com.github.YangsBryant:TeaPickerView:1.0.2'
主要代码
public class MainActivity extends AppCompatActivity {
@BindView(R.id.mButton)
Button button;
List<String> mProvinceDatas=new ArrayList<>();
Map<String, List<String>> mSecondDatas= new HashMap<>();
Map<String, List<String>> mThirdDatas= new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind( this );
intiPickerView();
}
private void intiPickerView(){
//一级列表
ProvinceBean provinceBean = new ProvinceBean();
mProvinceDatas.addAll(provinceBean.getRepData().getProvince());
//二级列表
SecondBean secondBean = new SecondBean();
mSecondDatas.putAll(secondBean.getRepData().getSecond());
//三级列表
ThirdBean thirdBean = new ThirdBean();
mThirdDatas.putAll(thirdBean.getRepData().getThird());
Log.i("json", JsonArrayUtil.toJson(mProvinceDatas));
Log.i("json",JsonArrayUtil.toJson(mSecondDatas));
Log.i("json",JsonArrayUtil.toJson(mThirdDatas));
//设置数据有多少层级
PickerData data=new PickerData();
data.setFirstDatas(mProvinceDatas);//json: ["广东","江西"]
data.setSecondDatas(mSecondDatas);//json: {"江西":["南昌","赣州"],"广东":["广州","深圳","佛山","东莞"]}
data.setThirdDatas(mThirdDatas);//json: {"广州":["天河区","白云区","番禹区","花都区"],"赣州":["章贡区","黄金开发区"],"东莞":["东城","南城"],"深圳":["南山区","宝安区","龙华区"],"佛山":["禅城区","顺德区"],"南昌":["东湖区","青云谱区","青山湖区"]}
data.setInitSelectText("请选择");
TeaPickerView teaPickerView =new TeaPickerView(this,data);
teaPickerView.setScreenH(3)
.setDiscolourHook(true)
.setRadius(25)
.setContentLine(true)
.setRadius(25)
.build();
button.setOnClickListener(v -> {
//显示选择器
teaPickerView.show(button);
});
//选择器点击事件
teaPickerView.setOnPickerClickListener(pickerData -> {
Toast.makeText(MainActivity.this,pickerData.getFirstText()+","+pickerData.getSecondText()+","+pickerData.getThirdText(),Toast.LENGTH_SHORT).show();
teaPickerView.dismiss();//关闭选择器
});
}
}
TeaPickerView属性大全
方法名 | 属性 |
---|---|
setHeights(int mHeight) | 显示具体的高度(dp),设置0是自适应(高度没有默认值,需要主动设置) |
setScreenH(int num) | 显示的高度占屏幕的百分比 |
setBackground(int color) | 设置整体的背景颜色 默认是#ffffff |
setRadius(int mRadius) | 设置圆角,默认0 |
setContentBackground(int color) | 内容栏的背景颜色 默认是#ffffff |
setContentHeight(int mHeight) | 内容栏的高度(dp) 默认是50dp |
setContentText(int size,int color) | 内容栏字体的大小和颜色, 默认是16sp,#0aa666,用此方法会固定颜色 |
setContentText(ColorStateList drawable) | 自定义内容栏字体颜色变换器 在res目录下创建color文件夹用selector 默认颜色#555 选中颜色#0aa666 |
setContentLine(boolean bl) | 内容栏选中是否有下划线 默认不开启 |
setContentLineColor(Drawable drawable) | 自定义内容栏下划线用layer-list 默认是下边框描边 颜色#0fbc72 高度1dp |
setLine(int mHeight,int color) | 分割线的高度和颜色 默认是0.5dp #e5e5e5 |
setitemHeight(int mHeight) | 设置list的item的高度(dp) 默认是40dp |
setListText(int size,int color) | 设置list的字体大小和颜色 默认是15 #555 |
setScrollBal(boolean bl) | 设置list是否显示滚动条,默认false |
setAlpha(float mFloat) | 设置阴影层的透明度 默认是0.5f |
setDiscolour(boolean bl) | 设置选中项是否加色,默认true |
setDiscolourColor(int color) | 设置选中项加色的颜色值,默认#0aa666 |
setDiscolourHook(boolean bl) | 设置选中项是否有√图标,默认false |
setCustomHook(Drawable drawable) | 自定义√图标 |
build() | 参数设置完毕,一定要build一下 |
方法名 | 属性 |
---|---|
setInitSelectText(String firstText) | 初始文字 |
setFirstDatas(List mFirstDatas) | 设置一级数据 |
setSecondDatas(Map<String, List> mSecondDatas) | 设置二级数据 |
setThirdDatas(Map<String, List> mThirdDatas) | 设置三级数据 |
setFourthDatas(Map<String, List> mFourthDatas) | 设置四级数据 |
给出参考bean地址
一级ProvinceBean 二级SecondBean 三级ThirdBean
默认内容栏字体颜色变换器
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/picker_select_text_color"/>
<item android:state_pressed="true" android:color="@color/picker_select_text_color"/>
<item android:state_checked="true" android:color="@color/picker_select_text_color"/>
<item android:state_focused="true" android:color="@color/picker_select_text_color"/>
<item android:color="@color/picker_text_color"/>
</selector>
默认内容栏下划线
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 边框颜色值 -->
<item>
<shape>
<solid android:color="@color/station_average" />
</shape>
</item>
<item android:bottom="1dp"> <!--设置只有底部有边框-->
<shape>
<solid android:color="#ffffff" />
</shape>
</item>
</layer-list>
联系QQ:961606042
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].