本文整理汇总了Java中android.view.FocusFinder.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java FocusFinder.getInstance方法的具体用法?Java FocusFinder.getInstance怎么用?Java FocusFinder.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.FocusFinder
的用法示例。
在下文中一共展示了FocusFinder.getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusSearch
import android.view.FocusFinder; //导入方法依赖的package包/类
@Override
public View focusSearch(View focused, int direction) {
View result = mLayout.onInterceptFocusSearch(focused, direction);
if (result != null) {
return result;
}
final FocusFinder ff = FocusFinder.getInstance();
result = ff.findNextFocus(this, focused, direction);
if (result == null && mAdapter != null && mLayout != null && !isComputingLayout()
&& !mLayoutFrozen) {
eatRequestLayout();
result = mLayout.onFocusSearchFailed(focused, direction, mRecycler, mState);
resumeRequestLayout(false);
}
return result != null ? result : super.focusSearch(focused, direction);
}
示例2: setUp
import android.view.FocusFinder; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
mFocusFinder = FocusFinder.getInstance();
// inflate the layout
final Context context = getContext();
final LayoutInflater inflater = LayoutInflater.from(context);
mRoot = (ViewGroup) inflater.inflate(R.layout.focus_2, null);
// manually measure it, and lay it out
mRoot.measure(500, 500);
mRoot.layout(0, 0, 500, 500);
mLeftButton = (Button) mRoot.findViewById(R.id.leftButton);
mCenterButton = (Button) mRoot.findViewById(R.id.centerButton);
mRightButton = (Button) mRoot.findViewById(R.id.rightButton);
}
示例3: focusSearch
import android.view.FocusFinder; //导入方法依赖的package包/类
@Override
public View focusSearch(View focused, int direction) {
View result = mLayout.onInterceptFocusSearch(focused, direction);
if (result != null) {
return result;
}
final FocusFinder ff = FocusFinder.getInstance();
result = ff.findNextFocus(this, focused, direction);
if (result == null && mAdapter != null) {
eatRequestLayout();
result = mLayout.onFocusSearchFailed(focused, direction, mRecycler, mState);
resumeRequestLayout(false);
}
return result != null ? result : super.focusSearch(focused, direction);
}
示例4: requestNaturalFocus
import android.view.FocusFinder; //导入方法依赖的package包/类
/**
* Request natural focus.
*
* @param direction direction in which focus is changing
* @param previouslyFocusedRect previously focus rectangle
*/
private void requestNaturalFocus(int direction, Rect previouslyFocusedRect) {
FocusFinder ff = FocusFinder.getInstance();
previouslyFocusedRect = previouslyFocusedRect == null
? new Rect(0, 0, 0, 0) : previouslyFocusedRect;
View toFocus = ff.findNextFocusFromRect(this, previouslyFocusedRect, direction);
toFocus = toFocus == null ? getChildAt(0) : toFocus;
if (toFocus != null) {
toFocus.requestFocus();
}
}
示例5: focusSearch
import android.view.FocusFinder; //导入方法依赖的package包/类
@Override
public View focusSearch(View focused, int direction) {
View result = mLayout.onInterceptFocusSearch(focused, direction);
if (result != null) {
return result;
}
final FocusFinder ff = FocusFinder.getInstance();
result = ff.findNextFocus(this, focused, direction);
if (result == null && mAdapter != null) {
eatRequestLayout();
result = mLayout.onFocusSearchFailed(focused, direction, mRecycler, mState);
resumeRequestLayout(false);
}
return result != null ? result : super.focusSearch(focused, direction);
}