我在片段中制作了一个水平回收视图.现在,当我点击任何项目时,我没有看到点击监听器工作.这是我的Adapter类的代码:
public class FeaturedProductsAdapter extends RecyclerView.Adapter<FeaturedProductsAdapter.CustomViewHolder> {
private List<FeaturedProductInfo> feedItemList;
private Context mContext;
public FeaturedProductsAdapter(Context context, List<FeaturedProductInfo> feedItemList) {
this.feedItemList = feedItemList;
this.mContext = context;
}
public class CustomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
protected ImageView imageView;
protected TextView textView,priceView;
private Context context;
public CustomViewHolder(View view,Context context) {
super(view);
this.context=context;
this.imageView = (ImageView) view.findViewById(R.id.thumbnail);
this.textView = (TextView) view.findViewById(R.id.prodTitle);
this.priceView = (TextView) view.findViewById(R.id.prodPrice);
view.setOnClickListener(this);
}
@Override
public void onClick(View view) {
int position = getLayoutPosition(); // gets item position
Log.e("Check", position …Run Code Online (Sandbox Code Playgroud) 我想从一页(比如 B)返回到上一页(比如 A)而不刷新它。我有一个页面 B,如果我手动使用它并手动按下退格键,它会返回到页面 A 而不刷新,但是当我使用时
myElement.send_keys(Keys.BACK_SPACE)
Run Code Online (Sandbox Code Playgroud)
在页面 B 上,它将我重定向到页面 A 并刷新页面。
注意:我在 python 中使用 selenium。
我已经创建了一个继承UpdateView的类视图.我已经指定了应该从中构建表单的字段和模型.现在说如果我有一个现场电子邮件,那么我想在表单中禁用它.我没有关于如何做到这一点的线索.
class UserUpdate(UpdateView):
model = Users
fields = ['email', 'first_name', 'last_name', 'birth_date']
template_name = 'users_update_form.html'
success_url = '/index/'
Run Code Online (Sandbox Code Playgroud)