main-目录下和java同级创建assets
导入类framework----------------需要手动删除报错的地方,重写即可
导入包fastjson-1.2.11.jarvalues
目录下style中添加<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!--需要添加-->
-<style parent="@android:style/Animation" name="Animation.Popup">
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style></resources>
//调用时的方法----也有其他方法
【MAIN】
全局配置【private Calendar calendar = Calendar.getInstance();】 //代码
switch (position){ case 0: //年月日 DatePicker picker = new DatePicker(getActivity()); picker.setRange(1980, 2015); picker.setSelectedItem(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH)); picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() { @Override public void onDatePicked(String year, String month, String day) { String s = year + "-" + month + "-" + day; list.get(position).state=s; adapter.addtest(list); } }); picker.show(); break; case 1: //双选年龄 /* AgePicker picker1 = new AgePicker(getActivity(), DateTimePicker.HOUR_OF_DAY); picker1.setRange(18, 65); picker1.setSelectedItem(18, 25, 18); picker1.setOnDateTimePickListener(new AgePicker.OnYearMonthDayTimePickListener() { @Override public void onDateTimePicked(String year, String month, String day, String hour, String minute) { String s2 =year+"-"+month; list.get(position).state=s2; adapter.addtext(list); } }); picker1.show();*/ //单选年龄 NumberPicker npicker = new NumberPicker(getActivity()); npicker.setOffset(2);//偏移量 npicker.setRange(12, 100);//数字范围 npicker.setSelectedItem(18); npicker.setLabel("岁"); npicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { String s2 =option+"岁"; list.get(position).state=s2; adapter.addtest(list); } }); npicker.show(); break; case 2: //星座 ConstellationPicker cpicker = new ConstellationPicker(getActivity()); cpicker.setTopBackgroundColor(0xFFEEEEEE); cpicker.setTopLineVisible(false); cpicker.setCancelTextColor(0xFF33B5E5); cpicker.setSubmitTextColor(0xFF33B5E5); cpicker.setTextColor(0xFFFF0000, 0xFFCCCCCC); cpicker.setLineColor(0xFFEE0000); cpicker.setSelectedItem("水瓶"); cpicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { String s3 =option+"座"; list.get(position).state=s3; adapter.addtest(list); } }); cpicker.show();break;
case 3://双选身高
HeightPicker picker2 = new HeightPicker(getActivity(), DateTimePicker.HOUR_OF_DAY);
picker2.setRange(150, 200);
picker2.setSelectedItem(150, 175, 175);
picker2.setOnDateTimePickListener(new HeightPicker.OnYearMonthDayTimePickListener() {
@Override
public void onDateTimePicked(String year, String month, String day, String hour, String minute) {
String s2 =year+"-"+month;
list.get(position).state=s2;
adapter.addtext(list);
}
});
picker2.show();
//身高
NumberPicker spicker = new NumberPicker(getActivity());
spicker.setOffset(2);//偏移量
spicker.setRange(145, 200);//数字范围
spicker.setSelectedItem(172);
spicker.setLabel("厘米");
spicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {//option+"厘米"
String s2 =option+"cm";
list.get(position).state=s2;
adapter.addtext(list);
}
});
spicker.show();*/
break;}switch (v.getId()){ case R.id.lable_f2_rl0_jiguan: //籍贯 try { ArrayList<AddressPicker.Province> data = new ArrayList<AddressPicker.Province>(); String json = AssetsUtils.readText(getActivity(), "city.json"); data.addAll(JSON.parseArray(json, AddressPicker.Province.class)); AddressPicker picker = new AddressPicker(getActivity(), data); // picker.setHideProvince(true); picker.setSelectedItem("北京市", "北京市", "东城区"); picker.setOnAddressPickListener(new AddressPicker.OnAddressPickListener() { @Override public void onAddressPicked(String province, String city, String county) { String jiguan = county + " " + province + " " + city; lable_f2_tv0_contentjiguan.setText(jiguan); } }); picker.show(); } catch (Exception e) { } break; case R.id.lable_f2_rl1_xueli: //学历 EducationBackGroundPicker picker = new EducationBackGroundPicker(getActivity()); picker.setTopBackgroundColor(0xFFEEEEEE); picker.setTopLineVisible(false); picker.setCancelTextColor(0xFF33B5E5); picker.setSubmitTextColor(0xFF33B5E5); picker.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker.setLineColor(0xFFEE0000); picker.setSelectedItem("本科"); picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv1_contentxueli.setText(option); } }); picker.show(); break; case R.id.lable_f2_rl2_zhiye: //职业 ProfessionPicker picker2 = new ProfessionPicker(getActivity()); picker2.setTopBackgroundColor(0xFFEEEEEE); picker2.setTopLineVisible(false); picker2.setCancelTextColor(0xFF33B5E5); picker2.setSubmitTextColor(0xFF33B5E5); picker2.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker2.setLineColor(0xFFEE0000); picker2.setSelectedItem("白领"); picker2.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv2_contentzhiye.setText(option); } }); picker2.show(); break; case R.id.lable_f3_rl2_shouru: //收入 IncomePicker picker3 = new IncomePicker(getActivity()); picker3.setTopBackgroundColor(0xFFEEEEEE); picker3.setTopLineVisible(false); picker3.setCancelTextColor(0xFF33B5E5); picker3.setSubmitTextColor(0xFF33B5E5); picker3.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker3.setLineColor(0xFFEE0000); picker3.setSelectedItem("2000-5000"); picker3.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv3_contentshouru.setText(option); } }); picker3.show(); break; case R.id.lable_f2_rl4_meilibuwei: //魅力部位 CharmPartPicker picker4 = new CharmPartPicker(getActivity()); picker4.setTopBackgroundColor(0xFFEEEEEE); picker4.setTopLineVisible(false); picker4.setCancelTextColor(0xFF33B5E5); picker4.setSubmitTextColor(0xFF33B5E5); picker4.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker4.setLineColor(0xFFEE0000); picker4.setSelectedItem("脸颊"); picker4.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv4_contentmeilibuwei.setText(option); } }); picker4.show(); break; case R.id.lable_f2_rl5_hunyin: //婚姻状况 MarriagePicker picker5 = new MarriagePicker(getActivity()); picker5.setTopBackgroundColor(0xFFEEEEEE); picker5.setTopLineVisible(false); picker5.setCancelTextColor(0xFF33B5E5); picker5.setSubmitTextColor(0xFF33B5E5); picker5.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker5.setLineColor(0xFFEE0000); picker5.setSelectedItem("未婚"); picker5.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv5_contenthunyin.setText(option); } }); picker5.show(); break; case R.id.lable_f2_rl6_zhufang: //住房 HousingConditionPicker picker6 = new HousingConditionPicker(getActivity()); picker6.setTopBackgroundColor(0xFFEEEEEE); picker6.setTopLineVisible(false); picker6.setCancelTextColor(0xFF33B5E5); picker6.setSubmitTextColor(0xFF33B5E5); picker6.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker6.setLineColor(0xFFEE0000); picker6.setSelectedItem("有房"); picker6.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv6_contentzhufang.setText(option); } }); picker6.show(); break; case R.id.lable_f2_rl7_love: //是否接受异地恋 DistanceRelationShipPicker picker7 = new DistanceRelationShipPicker(getActivity()); picker7.setTopBackgroundColor(0xFFEEEEEE); picker7.setTopLineVisible(false); picker7.setCancelTextColor(0xFF33B5E5); picker7.setSubmitTextColor(0xFF33B5E5); picker7.setTextColor(0xFFFF0000, 0xFFCCCCCC); picker7.setLineColor(0xFFEE0000); picker7.setSelectedItem("接受"); picker7.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { lable_f2_tv7_contentlove.setText(option); } }); picker7.show(); break;switch (v.getId()){ //名称 case R.id.lable_f0_rl0_name: builde = new AlertDialog.Builder(getActivity()); alertDialog = builde.create(); View view1=View.inflate(getActivity(),R.layout.f4_lable_f0_dialoglayout,null); alertDialog.setView(view1); f0_dialog_edtext = (EditText) view1.findViewById(R.id.f0_dialog_edtext); f0_dialog_btupdate = (Button) view1.findViewById(R.id.f0_dialog_btupdate); Window window = alertDialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); // 设置透明度为0.3 lp.alpha = 2f; window.setAttributes(lp); alertDialog.show(); f0_dialog_btupdate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //修改后的名字 nicknames = f0_dialog_edtext.getText().toString().trim(); lable_f0_tv0_contentnamae.setText(nicknames+""); Log.d("result","nicknames---------------------------"+ nicknames); alertDialog.dismiss(); } }); break; //生日 case R.id.lable_f0_rl1_brithday: //年月日 DatePicker picker = new DatePicker(getActivity()); picker.setRange(1980, 2015); picker.setSelectedItem(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH)); picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() { @Override public void onDatePicked(String year, String month, String day) { String birthdays = year + "-" + month + "-" + day; lable_f0_tv1_contentbrithday.setText(birthdays+""); Log.d("result","birthdays---------------------------"+ birthdays); } }); picker.show(); break; //年龄 case R.id.lable_f0_rl2_age: //单选年龄 NumberPicker npicker = new NumberPicker(getActivity()); npicker.setOffset(2);//偏移量 npicker.setRange(12, 100);//数字范围 npicker.setSelectedItem(18); npicker.setLabel("岁"); npicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { String ages = option + "岁"; lable_f0_tv2_contentage.setText(ages+""); Log.d("result","ages---------------------------"+ ages); } }); npicker.show(); break; //星座 case R.id.lable_f0_rl3_xingzuo: //星座 ConstellationPicker cpicker = new ConstellationPicker(getActivity()); cpicker.setTopBackgroundColor(0xFFEEEEEE); cpicker.setTopLineVisible(false); cpicker.setCancelTextColor(0xFF33B5E5); cpicker.setSubmitTextColor(0xFF33B5E5); cpicker.setTextColor(0xFFFF0000, 0xFFCCCCCC); cpicker.setLineColor(0xFFEE0000); cpicker.setSelectedItem("水瓶"); cpicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String option) { String xingzuos = option + "座"; lable_f0_tv3_contentxingzuo.setText(xingzuos+""); Log.d("result","xingzuos---------------------------"+ xingzuos); } }); cpicker.show(); break; //居住地 case R.id.lable_f0_rl4_province: //居住地 ArrayList<AddressPicker.Province> data = new ArrayList<AddressPicker.Province>(); String json = AssetsUtils.readText(getActivity(), "city.json"); data.addAll(JSON.parseArray(json, AddressPicker.Province.class)); AddressPicker apicker = new AddressPicker(getActivity(), data); apicker.setSelectedItem("贵州", "贵阳", "花溪"); //picker.setHideProvince(true);//加上此句举将只显示地级及县级 //picker.setHideCounty(true);//加上此句举将只显示省级及地级 apicker.setOnAddressPickListener(new AddressPicker.OnAddressPickListener() { public void onAddressPicked(String province, String city, String county) { String provinces = province + "-" + city + "-" + county; lable_f0_tv4_contentprovince.setText(provinces+""); } }); apicker.show(); break; //身高 case R.id.lable_f0_rl5_height: NumberPicker spicker = new NumberPicker// (getActivity()); spicker.setOffset(2);//偏移量 spicker.setRange(145, 200);//数字范围 spicker.setSelectedItem(172); spicker.setLabel("厘米"); spicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String height) {//option+"厘米" String heights = height + "厘米"; lable_f0_tv5_contentheight.setText(heights+""); } }); spicker.show(); break; //体重 case R.id.lable_f0_rl6_weight: //体重 NumberPicker picker_weight = new NumberPicker(getActivity()); // picker_weight.setAnimationStyle(R.style.Animation_CustomPopup); picker_weight.setOffset(2);//偏移 picker_weight.setRange(40, 100);//数字范围 picker_weight.setSelectedItem(65); picker_weight.setLabel("Kg"); picker_weight.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String weight) { String weights = weight + "公斤"; lable_f0_tv6_contentweight.setText(weights+""); } }); picker_weight.show(); break; //血型 case R.id.lable_f0_rl7_blood: BloodPartPicker booldpicker = new BloodPartPicker(getActivity()); booldpicker.setTopBackgroundColor(0xFFEEEEEE); booldpicker.setTopLineVisible(false); booldpicker.setCancelTextColor(0xFF33B5E5); booldpicker.setSubmitTextColor(0xFF33B5E5); booldpicker.setTextColor(0xFFFF0000, 0xFFCCCCCC); booldpicker.setLineColor(0xFFEE0000); booldpicker.setSelectedItem("A"); booldpicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() { @Override public void onOptionPicked(String blood) { String bloods = blood; lable_f0_tv7_contentblood.setText(bloods+""); } }); booldpicker.show(); break;
//所有的方法都有,类似调用即可package cn.qqtheme.androidpicker;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.github.florent37.viewanimator.ViewAnimator;
import java.util.ArrayList;
import java.util.Calendar;
import cn.qqtheme.framework.picker.AddressPicker;
import cn.qqtheme.framework.picker.ChineseZodiacPicker;
import cn.qqtheme.framework.picker.ColorPicker;
import cn.qqtheme.framework.picker.ConstellationPicker;
import cn.qqtheme.framework.picker.DatePicker;
import cn.qqtheme.framework.picker.DateTimePicker;
import cn.qqtheme.framework.picker.FilePicker;
import cn.qqtheme.framework.picker.LinkagePicker;
import cn.qqtheme.framework.picker.NumberPicker;
import cn.qqtheme.framework.picker.OptionPicker;
import cn.qqtheme.framework.picker.SexPicker;
import cn.qqtheme.framework.picker.TimePicker;
import cn.qqtheme.framework.util.ConvertUtils;
import cn.qqtheme.framework.util.DateUtils;
import cn.qqtheme.framework.util.StorageUtils;
public class MainActivity extends Activity {
private Calendar calendar = Calendar.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void onBackPressed() {
System.exit(0);
android.os.Process.killProcess(android.os.Process.myPid());
finish();
}
private void showToast(String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
//体重
public void onAnimationStyle(View view) {
NumberPicker picker = new NumberPicker(this);
picker.setAnimationStyle(R.style.Animation_CustomPopup);
picker.setOffset(2);//偏移
picker.setRange(40, 100);//数字范围
picker.setSelectedItem(65);
picker.setLabel("Kg");
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option);
}
});
picker.show();
//身高///
NumberPicker spicker = new NumberPicker//
(My_NewActivity1.this);
spicker.setOffset(2);//偏移量
spicker.setRange(145, 200);//数字范围
spicker.setSelectedItem(172);
spicker.setLabel("厘米");
spicker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {//option+"厘米"
}
});
spicker.show();
break;
}
//
public void onAnimator(View view) {
CustomHeaderAndFooterPicker picker = new CustomHeaderAndFooterPicker(this);
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option);
}
});
picker.show();
}
//年月日
public void onYearMonthDayPicker(View view) {
DatePicker picker = new DatePicker(this);
picker.setRange(2000, 2030);
picker.setSelectedItem(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH));
picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() {
@Override
public void onDatePicked(String year, String month, String day) {
showToast(year + "-" + month + "-" + day);
}
});
picker.show();
}
//年月日小时分钟
public void onYearMonthDayTimePicker(View view) {
DateTimePicker picker = new DateTimePicker(this, DateTimePicker.HOUR_OF_DAY);
picker.setRange(2000, 2030);
picker.setSelectedItem(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH),
calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE));
picker.setOnDateTimePickListener(new DateTimePicker.OnYearMonthDayTimePickListener() {
@Override
public void onDateTimePicked(String year, String month, String day, String hour, String minute) {
showToast(year + "-" + month + "-" + day + " " + hour + ":" + minute);
}
});
picker.show();
}
public void onYearMonthPicker(View view) {
DatePicker picker = new DatePicker(this, DatePicker.YEAR_MONTH);
picker.setRange(1990, 2015);
picker.setOnDatePickListener(new DatePicker.OnYearMonthPickListener() {
@Override
public void onDatePicked(String year, String month) {
showToast(year + "-" + month);
}
});
picker.show();
}
public void onMonthDayPicker(View view) {
DatePicker picker = new DatePicker(this, DatePicker.MONTH_DAY);
picker.setOnDatePickListener(new DatePicker.OnMonthDayPickListener() {
@Override
public void onDatePicked(String month, String day) {
showToast(month + "-" + day);
}
});
picker.show();
}
public void onTimePicker(View view) {
//默认选中当前时间
TimePicker picker = new TimePicker(this, TimePicker.HOUR_OF_DAY);
picker.setTopLineVisible(false);
picker.setOnTimePickListener(new TimePicker.OnTimePickListener() {
@Override
public void onTimePicked(String hour, String minute) {
showToast(hour + ":" + minute);
}
});
picker.show();
}
//选择者
public void onOptionPicker(View view) {
OptionPicker picker = new OptionPicker(this, new String[]{
"绗竴椤?, "绗簩椤?, "杩欐槸涓€涓緢闀垮緢闀垮緢闀垮緢闀垮緢闀垮緢闀垮緢闀垮緢闀垮緢闀跨殑寰堥暱寰堥暱鐨勫緢闀垮緢闀跨殑椤?
});
picker.setOffset(2);
picker.setSelectedIndex(1);
picker.setTextSize(11);
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option);
}
});
picker.show();
}
//连接
public void onLinkage(View view) {
ArrayList<String> firstList = new ArrayList<String>();
firstList.add("今天");
firstList.add("明天");
ArrayList<ArrayList<String>> secondList = new ArrayList<ArrayList<String>>();
ArrayList<String> secondListItem = new ArrayList<String>();
for (int i = 0; i < 24; i++) {
secondListItem.add(DateUtils.fillZero(i) + "?);
}
secondList.add(secondListItem);//对应今天
secondList.add(secondListItem);//对应明天
ArrayList<ArrayList<ArrayList<String>>> thirdList = new ArrayList<ArrayList<ArrayList<String>>>();
ArrayList<ArrayList<String>> thirdListItem1 = new ArrayList<ArrayList<String>>();
ArrayList<String> thirdListItem2 = new ArrayList<String>();
for (int i = 0; i < 60; i++) {
thirdListItem2.add(DateUtils.fillZero(i) + "?);
}
for (int i = 0; i < 24; i++) {
thirdListItem1.add(thirdListItem2);对应0-23 }
thirdList.add(thirdListItem1);//对应今天
thirdList.add(thirdListItem1);//对应明天
LinkagePicker picker = new LinkagePicker(this, firstList, secondList);
picker.setSelectedItem("明天", "9 ?);
picker.setOnLinkageListener(new LinkagePicker.OnLinkageListener() {
@Override
public void onPicked(String first, String second, String third) {
showToast(first + "-" + second + "-" + third);
}
});
picker.show();
}
//星座
public void onConstellationPicker(View view) {
ConstellationPicker picker = new ConstellationPicker(this);
picker.setTopBackgroundColor(0xFFEEEEEE);
picker.setTopLineVisible(false);
picker.setCancelTextColor(0xFF33B5E5);
picker.setSubmitTextColor(0xFF33B5E5);
picker.setTextColor(0xFFFF0000, 0xFFCCCCCC);
picker.setLineColor(0xFFEE0000);
picker.setSelectedItem("水瓶");
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option+"座");
}
});
picker.show();
}
public void onChineseZodiacPicker(View view) {
ChineseZodiacPicker picker = new ChineseZodiacPicker(this);
picker.setLineVisible(false);
picker.setSelectedItem("缇?);
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option);
}
});
picker.show();
}
//年龄
public void onNumberPicker(View view) {
NumberPicker picker = new NumberPicker(this);
picker.setOffset(2);//偏移
picker.setRange(12, 100);//数字范围
picker.setSelectedItem(18);
picker.setLabel("岁");
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option+"岁");
}
});
picker.show();
}
public void onSexPicker(View view) {
SexPicker picker = new SexPicker(this);
//picker.onlyMaleAndFemale();
picker.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
@Override
public void onOptionPicked(String option) {
showToast(option);
}
});
picker.show();
}
//地址
public void onAddressPicker(View view) {
new AddressInitTask(this).execute("贵州", "毕节", "纳雍");
}
//所在地城市省份
public void onAddress2Picker(View view) {
//所在地城市省份
ArrayList<AddressPicker.Province> data = new ArrayList<AddressPicker.Province>();
String json = AssetsUtils.readText(My_NewActivity1.this, "city.json");
data.addAll(JSON.parseArray(json, AddressPicker.Province.class));
AddressPicker picker = new AddressPicker(My_NewActivity1.this, data);
picker.setSelectedItem("贵州", "贵阳", "花溪");
//picker.setHideProvince(true);//加上此句举将只显示地级及县级
//picker.setHideCounty(true);//加上此句举将只显示省级及地级
picker.setOnAddressPickListener(new AddressPicker.OnAddressPickListener() {
@Override
public void onAddressPicked(String province, String city, String county) {
list.get(position).state = city + county;
adapter.addtest(list);
}
});
picker.show();
}
public void onAddress3Picker(View view) {
new AddressInitTask(this, true).execute("四川", "成都");
}
public void onColorPicker(View view) {
ColorPicker picker = new ColorPicker(this);
picker.setInitColor(0xDD00DD);
picker.setOnColorPickListener(new ColorPicker.OnColorPickListener() {
@Override
public void onColorPicked(int pickedColor) {
showToast(ConvertUtils.toColorString(pickedColor));
}
});
picker.show();
}
public void onFilePicker(View view) {
//noinspection MissingPermission
FilePicker picker = new FilePicker(this, FilePicker.FILE);
picker.setShowHideDir(false);
//picker.setAllowExtensions(new String[]{".apk"});
picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
@Override
public void onFilePicked(String currentPath) {
showToast(currentPath);
}
});
picker.show();
}
public void onDirPicker(View view) {
//noinspection MissingPermission
FilePicker picker = new FilePicker(this, FilePicker.DIRECTORY);
picker.setRootPath(StorageUtils.getRootPath(this) + "Download/");
picker.setOnFilePickListener(new FilePicker.OnFilePickListener() {
@Override
public void onFilePicked(String currentPath) {
showToast(currentPath);
}
});
picker.show();
}
public void onContact(View view) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:liyujiang_tk@yeah.net"));
intent.putExtra(Intent.EXTRA_CC, new String[]
{"1032694760@qq.com"});
intent.putExtra(Intent.EXTRA_EMAIL, "");
intent.putExtra(Intent.EXTRA_TEXT, "欢迎提供意您的见或建");
startActivity(Intent.createChooser(intent, "选择邮件客户"));
}
}
一二三级联动
最新推荐文章于 2019-08-19 18:12:35 发布