Java Code Examples for android.view.ViewGroup#setFocusableInTouchMode()

The following examples show how to use android.view.ViewGroup#setFocusableInTouchMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasePickerView.java    From AndroidFrame with Apache License 2.0 6 votes vote down vote up
public void setKeyBackCancelable(boolean isCancelable) {

        ViewGroup View;
        if (isDialog()) {
            View = dialogView;
        } else {
            View = rootView;
        }

        View.setFocusable(isCancelable);
        View.setFocusableInTouchMode(isCancelable);
        if (isCancelable) {
            View.setOnKeyListener(onKeyBackListener);
        } else {
            View.setOnKeyListener(null);
        }
    }
 
Example 2
Source File: FullScreenDialogFragment.java    From FullScreenDialog with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    initBuilderArguments();

    if (fullScreen)
        hideActivityActionBar(savedInstanceState == null);

    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.full_screen_dialog, container, false);

    initToolbar(view);

    if (fullScreen)
        setThemeBackground(view);

    view.setFocusableInTouchMode(true);
    view.requestFocus();

    return view;
}
 
Example 3
Source File: BasePickerView.java    From Android-PickerView with Apache License 2.0 6 votes vote down vote up
public void setKeyBackCancelable(boolean isCancelable) {

        ViewGroup View;
        if (isDialog()) {
            View = dialogView;
        } else {
            View = rootView;
        }

        View.setFocusable(isCancelable);
        View.setFocusableInTouchMode(isCancelable);
        if (isCancelable) {
            View.setOnKeyListener(onKeyBackListener);
        } else {
            View.setOnKeyListener(null);
        }
    }
 
Example 4
Source File: BasePickerView.java    From Android-PickerView with Apache License 2.0 6 votes vote down vote up
public void setKeyBackCancelable(boolean isCancelable) {

        ViewGroup View;
        if (isDialog()) {
            View = dialogView;
        } else {
            View = rootView;
        }

        View.setFocusable(isCancelable);
        View.setFocusableInTouchMode(isCancelable);
        if (isCancelable) {
            View.setOnKeyListener(onKeyBackListener);
        } else {
            View.setOnKeyListener(null);
        }
    }
 
Example 5
Source File: EditTextDefaultFocus.java    From budget-envelopes with GNU General Public License v3.0 6 votes vote down vote up
@Override protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (mDefaultFocus) {
        if (getContext() instanceof Activity) {
            ((Activity)getContext())
            .getWindow()
             .setSoftInputMode(WindowManager
                               .LayoutParams
                                .SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
        requestFocus();
    } else {
        ViewGroup parent = (ViewGroup)getParent();
        //while (parent.getParent() instanceof ViewGroup) {
        //    parent = (ViewGroup)parent.getParent();
        //}
        parent.setFocusableInTouchMode(true);
        parent.requestFocus();
        clearFocus();
    }
}