迷茫2017-04-18 10:48:03
Why does it have to be nested? You can have a listview on the left and a listview or fragment on the right. When you click on the item of the listview, wouldn’t it be nice to change the data on the right
伊谢尔伦2017-04-18 10:48:03
The layout of item can be a TextView and a LinearLayout, where LinearLayout can addView.
The pseudo code is as follows, first encapsulate the data
class CourseList{
String name;
List<Course> courses;
}
When binding data in Adapter,
TextView.setText(name)
for(i=0;i<courses.size();i++){
TextView tv =new TextView();
tv.setText(courses.get(i).name);
LinearLayout.add(tv);
}
Another idea is that the layout of the item is TextView and RecycleView, but considering that when the number of specific courses exceeds the screen height, there will be a sliding conflict with the parent ListView, which is very troublesome to solve.
阿神2017-04-18 10:48:03
The solution mentioned above is a solution, but actually nesting is not that troublesome. You rewrite the onDispatchTouchEvent event of the child view and make a sliding gesture judgment. If it is sliding, give up processing the entire event sequence, or rewrite the parent view. OnDispatchTouchEvent is no longer distributed when it slides. The principle is the same.