本文整理了Java中android.support.v7.widget.GridLayoutManager.onFocusSearchFailed()
方法的一些代码示例,展示了GridLayoutManager.onFocusSearchFailed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.onFocusSearchFailed()
方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:onFocusSearchFailed
暂无
代码示例来源:origin: Dawish/BriskTVLauncher
/**
* 焦点搜索失败处理.
*/
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler,
RecyclerView.State state) {
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
return null;
}
代码示例来源:origin: hejunlin2013/TVSample
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler,
RecyclerView.State state) {
// Need to be called in order to layout new row/column
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
if (nextFocus == null) {
return null;
}
int fromPos = getPosition(focused);
int nextPos = getNextViewPos(fromPos, focusDirection);
return findViewByPosition(nextPos);
}
代码示例来源:origin: hejunlin2013/LivePlayback
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler,
RecyclerView.State state) {
// Need to be called in order to layout new row/column
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
if (nextFocus == null) {
return null;
}
int fromPos = getPosition(focused);
int nextPos = getNextViewPos(fromPos, focusDirection);
return findViewByPosition(nextPos);
}
代码示例来源:origin: evilbinary/TvWidget
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler,
RecyclerView.State state) {
// Need to be called in order to layout new row/column
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
if (nextFocus == null) {
return null;
}
int fromPos = getPosition(focused);
int nextPos = getNextViewPos(fromPos, focusDirection);
return findViewByPosition(nextPos);
}
代码示例来源:origin: Dawish/BriskTVLauncher
/**
* Called when searching for a focusable view in the given direction has failed for the current content of the RecyclerView.
* This is the LayoutManager's opportunity to populate views in the given direction to fulfill the request if it can.
* The LayoutManager should attach and return the view to be focused. The default implementation returns null.
* 防止当recyclerview上下滚动的时候焦点乱跳
* @param focused
* @param focusDirection
* @param recycler
* @param state
* @return
*/
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler, RecyclerView.State state) {
// Need to be called in order to layout new row/column
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
if (nextFocus == null) {
return null;
}
/**
* 获取当前焦点的位置
*/
int fromPos = getPosition(focused);
/**
* 获取我们希望的下一个焦点的位置
*/
int nextPos = getNextViewPos(fromPos, focusDirection);
return findViewByPosition(nextPos);
}
代码示例来源:origin: 66668/DropDownMenuplus
/**
* Called when searching for a focusable view in the given direction has failed for the current content of the RecyclerView.
* This is the LayoutManager's opportunity to populate views in the given direction to fulfill the request if it can.
* The LayoutManager should attach and return the view to be focused. The default implementation returns null.
* 防止当recyclerview上下滚动的时候焦点乱跳
* @param focused
* @param focusDirection
* @param recycler
* @param state
* @return
*/
@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler, RecyclerView.State state) {
// Need to be called in order to layout new row/column
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
if (nextFocus == null) {
return null;
}
/**
* 获取当前焦点的位置
*/
int fromPos = getPosition(focused);
/**
* 获取我们希望的下一个焦点的位置
*/
int nextPos = getNextViewPos(fromPos, focusDirection);
return findViewByPosition(nextPos);
}
代码示例来源:origin: Dreamxiaoxuan/AndroidTvDemo
View nextFocus = super.onFocusSearchFailed(focused, focusDirection, recycler, state);
内容来源于网络,如有侵权,请联系作者删除!