當前位置: 首頁>>代碼示例>>Java>>正文


Java SinglePicker.setOnItemPickListener方法代碼示例

本文整理匯總了Java中cn.addapp.pickers.picker.SinglePicker.setOnItemPickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java SinglePicker.setOnItemPickListener方法的具體用法?Java SinglePicker.setOnItemPickListener怎麽用?Java SinglePicker.setOnItemPickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cn.addapp.pickers.picker.SinglePicker的用法示例。


在下文中一共展示了SinglePicker.setOnItemPickListener方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showConstellationPicker

import cn.addapp.pickers.picker.SinglePicker; //導入方法依賴的package包/類
/**
 * 星座選擇器
 * @param activity
 * @param current  當前星座
 * @param listener
 */
public void showConstellationPicker(Activity activity,String current,final ItemListener listener){
    SinglePicker<String> picker = new SinglePicker<>(activity,
           new String[]{"水瓶座", "雙魚座", "白羊座", "金牛座", "雙子座", "巨蟹座", "獅子座",
                   "處女座", "天秤座", "天蠍座", "射手座", "摩羯座"});
    picker.setCanLoop(false);//不禁用循環
    picker.setWheelModeEnable(true);
    picker.setWidth(picker.getScreenWidthPixels());
    picker.setLineVisible(false);
    picker.setTopBackgroundColor(0xFFFEE61B);
    picker.setTitleText("星座");
    picker.setTitleTextColor(0xFF000000);
    picker.setTitleTextSize(14);
    picker.setCancelTextColor(0xFF4D4D4D);
    picker.setCancelTextSize(14);
    picker.setSubmitTextColor(0xFF4D4D4D);
    picker.setPressedTextColor(0xFF4D4D4D);
    picker.setSubmitTextSize(14);
    picker.setTopHeight(48);
    picker.setSelectedTextColor(0xFFFEE61B);
    picker.setSelectedItem(current);
    picker.setOnItemPickListener(new OnItemPickListener<String>() {
        @Override
        public void onItemPicked(int index, String item) {
            listener.onItemPicked(index,item);
        }
    });
    picker.show();

}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:36,代碼來源:OvPicker.java

示例2: showSexPicker

import cn.addapp.pickers.picker.SinglePicker; //導入方法依賴的package包/類
/**
 * 顯示性別選擇器
 * @param activity
 * @param sex
 * @param listener
 */
public void showSexPicker(Activity activity,String sex,final ItemListener listener){
    SinglePicker<String> picker = new SinglePicker<>(activity,
            new String[]{"男", "女"});
    picker.setCanLoop(false);//不禁用循環
    picker.setWheelModeEnable(true);
    picker.setWidth(picker.getScreenWidthPixels());
    picker.setLineVisible(false);
    picker.setTopBackgroundColor(0xFFFEE61B);
    picker.setTitleText("性別");
    picker.setTitleTextColor(0xFF000000);
    picker.setTitleTextSize(14);
    picker.setCancelTextColor(0xFF4D4D4D);
    picker.setCancelTextSize(14);
    picker.setSubmitTextColor(0xFF4D4D4D);
    picker.setPressedTextColor(0xFF4D4D4D);
    picker.setSubmitTextSize(14);
    picker.setTopHeight(48);
    picker.setSelectedTextColor(0xFFFEE61B);
    picker.setSelectedItem(sex);
    picker.setOnItemPickListener(new OnItemPickListener<String>() {
        @Override
        public void onItemPicked(int index, String item) {
            listener.onItemPicked(index,item);
        }
    });
    picker.show();
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:34,代碼來源:OvPicker.java

示例3: showIndustryPicker

import cn.addapp.pickers.picker.SinglePicker; //導入方法依賴的package包/類
/**
 * 顯示所在行業選擇器
 * @param activity
 * @param listener
 */
public void showIndustryPicker(Activity activity,final ItemListener listener){
    SinglePicker<String> picker = new SinglePicker<>(activity,
            new String[]{"學生","文化/藝術","影視/娛樂","金融",
                    "醫藥/健康","工業/製造業","IT/互聯網/通信",
                    "媒體/公關","個體經營","教育/科研","其他"});
    picker.setCanLoop(false);//不禁用循環
    picker.setWheelModeEnable(true);
    picker.setWidth(picker.getScreenWidthPixels());
    picker.setLineVisible(false);
    picker.setTopBackgroundColor(0xFFFEE61B);
    picker.setTitleText("所在行業");
    picker.setTitleTextColor(0xFF000000);
    picker.setTitleTextSize(14);
    picker.setCancelTextColor(0xFF4D4D4D);
    picker.setCancelTextSize(14);
    picker.setSubmitTextColor(0xFF4D4D4D);
    picker.setPressedTextColor(0xFF4D4D4D);
    picker.setSubmitTextSize(14);
    picker.setTopHeight(48);
    picker.setSelectedTextColor(0xFFFEE61B);
    picker.setOnItemPickListener(new OnItemPickListener<String>() {
        @Override
        public void onItemPicked(int index, String item) {
            listener.onItemPicked(index,item);
        }
    });
    picker.show();
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:34,代碼來源:OvPicker.java

示例4: showEmotionalPicker

import cn.addapp.pickers.picker.SinglePicker; //導入方法依賴的package包/類
/**
 * 顯示情感狀態選擇器
 * @param activity
 * @param emotional
 * @param listener
 */
public void showEmotionalPicker(Activity activity,String emotional,final ItemListener listener){
    SinglePicker<String> picker = new SinglePicker<>(activity,
            new String[]{"保密","單身","已婚","同性"});
    picker.setCanLoop(false);//不禁用循環
    picker.setWheelModeEnable(true);
    picker.setWidth(picker.getScreenWidthPixels());
    picker.setLineVisible(false);
    picker.setTopBackgroundColor(0xFFFEE61B);
    picker.setTitleText("情感狀態");
    picker.setTitleTextColor(0xFF000000);
    picker.setTitleTextSize(14);
    picker.setCancelTextColor(0xFF4D4D4D);
    picker.setCancelTextSize(14);
    picker.setSubmitTextColor(0xFF4D4D4D);
    picker.setPressedTextColor(0xFF4D4D4D);
    picker.setSubmitTextSize(14);
    picker.setSelectedItem(emotional);
    picker.setTopHeight(48);
    picker.setSelectedTextColor(0xFFFEE61B);
    picker.setOnItemPickListener(new OnItemPickListener<String>() {
        @Override
        public void onItemPicked(int index, String item) {
            listener.onItemPicked(index,item);
        }
    });
    picker.show();
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:34,代碼來源:OvPicker.java

示例5: onConstellationPicker

import cn.addapp.pickers.picker.SinglePicker; //導入方法依賴的package包/類
public void onConstellationPicker(View view) {
    boolean isChinese = Locale.getDefault().getDisplayLanguage().contains("中文");
    SinglePicker<String> picker = new SinglePicker<>(this,
            isChinese ? new String[]{
                    "水瓶座", "雙魚座", "白羊座", "金牛座", "雙子座", "巨蟹座",
                    "獅子座", "處女座", "天秤座", "天蠍座", "射手座", "摩羯座"
            } : new String[]{
                    "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer",
                    "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn"
            });
    picker.setCanLoop(false);//不禁用循環
    picker.setTopBackgroundColor(0xFFEEEEEE);
    picker.setTopHeight(50);
    picker.setTopLineColor(0xFF33B5E5);
    picker.setTopLineHeight(1);
    picker.setTitleText(isChinese ? "請選擇" : "Please pick");
    picker.setTitleTextColor(0xFF999999);
    picker.setTitleTextSize(12);
    picker.setCancelTextColor(0xFF33B5E5);
    picker.setCancelTextSize(13);
    picker.setSubmitTextColor(0xFF33B5E5);
    picker.setSubmitTextSize(13);
    picker.setSelectedTextColor(0xFFEE0000);
    picker.setUnSelectedTextColor(0xFF999999);
    LineConfig config = new LineConfig();
    config.setColor(0xFFEE0000);//線顏色
    config.setAlpha(140);//線透明度
    config.setRatio((float) (1.0 / 8.0));//線比率
    picker.setLineConfig(config);
    picker.setItemWidth(200);
    picker.setBackgroundColor(0xFFE1E1E1);
    //picker.setSelectedItem(isChinese ? "處女座" : "Virgo");
    picker.setSelectedIndex(7);
    picker.setOnItemPickListener(new OnItemPickListener<String>() {
        @Override
        public void onItemPicked(int index, String item) {
            showToast("index=" + index + ", item=" + item);
        }
    });
    picker.show();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:42,代碼來源:MainActivity.java


注:本文中的cn.addapp.pickers.picker.SinglePicker.setOnItemPickListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。