亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

java - 安卓 如何實現(xiàn)RecyclerView嵌套listview 實現(xiàn)類似淘寶購物車這種的數(shù)據(jù)顯示
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-04-18 10:46:03
0
3
1131
PHP中文網(wǎng)
PHP中文網(wǎng)

認證0級講師

reply all(3)
迷茫

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

伊謝爾倫

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.

阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template