本文整理匯總了Java中android.support.v7.widget.CardView.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java CardView.setFocusable方法的具體用法?Java CardView.setFocusable怎麽用?Java CardView.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.setFocusable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateViewHolder
import android.support.v7.widget.CardView; //導入方法依賴的package包/類
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int position) {
View view;
if (mItems.get(position).cacheable()) {
if (mViews.containsKey(mItems.get(position))) {
view = mViews.get(mItems.get(position));
} else {
mViews.put(mItems.get(position), view = LayoutInflater.from(parent.getContext())
.inflate(mItems.get(position).getLayoutRes(), parent, false));
}
} else {
view = LayoutInflater.from(parent.getContext())
.inflate(mItems.get(position).getLayoutRes(), parent, false);
}
ViewGroup viewGroup = (ViewGroup) view.getParent();
if (viewGroup != null) {
viewGroup.removeView(view);
}
if (mItems.get(position).cardCompatible()
&& Prefs.getBoolean("forcecards", false, view.getContext())) {
CardView cardView = new CardView(view.getContext());
cardView.setRadius(view.getResources().getDimension(R.dimen.cardview_radius));
cardView.setCardElevation(view.getResources().getDimension(R.dimen.cardview_elevation));
cardView.setUseCompatPadding(true);
cardView.setFocusable(false);
cardView.addView(view);
view = cardView;
}
if (position == 0) {
mFirstItem = view;
}
mItems.get(position).setOnViewChangeListener(mOnViewChangedListener);
mItems.get(position).onCreateHolder(parent, view);
return new RecyclerView.ViewHolder(view) {
};
}