0
我尝试将视图添加到RecyclerView
时,点击Button
在ViewHolder
中。将视图添加到RecyclerView
当点击Button
在ViewHolder3
,一个视图(视图中添加更多)将增加并且出现上述情况类似的图像。
ViewAddMore
将固定在那里,RecyclerView
可以正常滚动。
我试过但没有找到任何解决方案,我的问题; 对我的问题有任何建议吗?
我尝试将视图添加到RecyclerView
时,点击Button
在ViewHolder
中。将视图添加到RecyclerView
当点击Button
在ViewHolder3
,一个视图(视图中添加更多)将增加并且出现上述情况类似的图像。
ViewAddMore
将固定在那里,RecyclerView
可以正常滚动。
我试过但没有找到任何解决方案,我的问题; 对我的问题有任何建议吗?
请使用PopupWindow显示此视图。
// get a reference to the already created main layout
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.activity_main_layout);
// inflate the layout of the popup window
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = inflater.inflate(R.layout.popup_window, null);
// create the popup window
int width = LinearLayout.LayoutParams.WRAP_CONTENT;
int height = LinearLayout.LayoutParams.WRAP_CONTENT;
boolean focusable = true; // lets taps outside the popup also dismiss it
final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable);
// show the popup window
popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0);
// dismiss the popup window when touched
popupView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
popupWindow.dismiss();
return true;
}
});
希望这会帮助你。
那么,你想在哪里看到ViewAddMore? – Raghavendra
@Raghavendra:它是动态的。当用户点击按钮时,ViewAddMore将出现在ViewHolder1和ViewHolder2上方。 –
我建议你不要这样做。它真的很糟糕的设计,通过一个弹出框来阻止您的recyclerViews视图。 –