Comments (8)
你怎么设置的?我通过线程或回调事件设置都可以被刷新:
new Thread(new Runnable() {
@Override
public void run() {
SystemClock.sleep(3000);
runOnUiThread(new Runnable() {
@Override
public void run() {
final List<String> newData = new ArrayList<>();
newData.add("AigeStudio");
newData.add("Fuck");
newData.add("Bull shit");
straightPicker.setData(newData);
straightPicker.setItemIndex(0);
}
});
}
}).start();
点击事件:
case R.id.main_obtain_straight_btn:
final List<String> newData = new ArrayList<>();
newData.add("AigeStudio");
newData.add("Fuck");
newData.add("Bull shit");
straightPicker.setData(newData);
straightPicker.setItemIndex(0);
break;
from wheelpicker.
很感谢您的答复,其实我是要做省市2级滚动,当省变化时我需要更改city的data
但是代码如下实现确实如我所说,不能正确显示
cityList是个2维列表
province.setOnWheelChangeListener(new OnWheelChangeListener() {
@Override
public void onWheelSelected(int index, String data) {
// TODO Auto-generated method stub
city.setData(cityList.get(index));
city.setItemIndex(0);
}
....
}
from wheelpicker.
= = 不会吧,数据没问题么,你可以参考WheelDatePicker日期选择这个控件,跟省市区联动逻辑是一致的,只是数据不同而已,WheelDatePicker在滑动后会根据不同的月份显示不同的天数,因为每个月天数不是相同的
from wheelpicker.
WheelDatePicker在滑动后会根据不同的月份显示不同的天数,能麻烦你帮我找找关键代码吗,我也一直在找从31天切换到30天的月份后picker会自动切换回去,我代码大概看了下,原以为是因为DayPicker调用了init方法,但是试了下Init打方法还是没有效果
from wheelpicker.
WheelDayPicker里面setCurrentYearAndMonth方法:
public void setCurrentYearAndMonth(int year, int month) {
setYear(year);
setMonth(month);
initData();
checkScrollState();
}
checkScrollState
from wheelpicker.
这个方法我试过了
@OverRide
public void onWheelSelected(int index, String data) {
// TODO Auto-generated method stub
city.clearCache();
city.setData(cityList.get(index));
city.setItemIndex(0);
//city.checkScrollState();
//city.requestLayout();
Log.i("test", "province index is " + index);
Log.i("test", "province data is " + data);
}
这些我全试了,还是不行,可以的话,我想把源代码Demo给你,你帮我看看,如果你有空的话,留个邮箱给我,我发demo给你
from wheelpicker.
from wheelpicker.
感谢您的帮助,当我在准备Demo的时候,我又尝试了下,发现的2个问题解决了
1:当第一次的的数据源size大于第二次的数据源size时,可能会出现数据显示不出来,checkScrollState可以解决这个问题
2:有时候数据源切换的时候,pick不会自动刷新,显示的还是原来的数据,需要点击picker才会显示最新的数据,手动调用invalidate可以解决
以下代码尝试过,没有问题,再次感谢您的帮助
province.setOnWheelChangeListener(new OnWheelChangeListener() {
@Override
public void onWheelSelected(int index, String data) {
// TODO Auto-generated method stub
city.setData(cityList.get(index));
city.setItemIndex(0);
city.checkScrollState();
city.invalidate();
}
from wheelpicker.
Related Issues (20)
- picker crash NullPointerException. HOT 1
- Turn of perspective effect. HOT 1
- 支持横向滚动吗
- How to allow multi line items in wheel picker
- 请问有计划出一个react-native插件吗 HOT 1
- 多列wheelpicker时纯数字picker会比纯字母picker稍微矮 1px
- How to disable picker srolling... setEnabled(false) doesn't work
- Bintray sunsetting HOT 2
- JCenter HOT 2
- 怎么设置只绘制一行item,上下的都不绘制,类似老虎机,随机选择选项?
- Could not find cn.aigestudio.wheelpicker:WheelPicker:1.0.3. HOT 9
- How to vibrate when data changed like iphone?
- the Wheel is too much space above and below
- Is this library dead? HOT 5
- 画面丢失 HOT 3
- this project is dead
- Curtain is in front of Wheel
- 设置selectedItemPosition不起作用 HOT 1
- Hh
- 选中的字体没法调节大小
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wheelpicker.