ViewGroup setDescendantFocusability - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ViewGroup setDescendantFocusability method.

This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
            // also takes care of putting focus on it when not in touch mode. 
            // The jerk. 
            // This hack tries to prevent this from pulling focus out of our 
            // ViewPager. 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:setDescendantFocusability, setFastScrollEnabled, setSmoothScrollbarEnabled, setTranscriptMode, setAdapter
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
	@Override 
	public void onPageSelected(int position)
	{ 
		// this hack tries to prevent this from pulling focus out of our ViewPager 
		TabWidget widget = mTabHost.getTabWidget();
		int oldFocusability = widget.getDescendantFocusability();
		widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
		mTabHost.setCurrentTab(position);
		widget.setDescendantFocusability(oldFocusability);
	} 
 
	 
	@Override 
	public void onPageScrollStateChanged(int state)
	{ 
 
	} 
 
 
	@Override 
7
CodeRank
This code example shows how to use the following methods:requestRectangleOnScreen, getDescendantFocusability, setDescendantFocusability, getChildTabViewAt
        // also takes care of putting focus on it when not in touch mode. 
        // The jerk. 
        // This hack tries to prevent this from pulling focus out of our 
        // ViewPager. 
        TabWidget widget = mTabHost.getTabWidget();
        int oldFocusability = widget.getDescendantFocusability();
        widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
        mTabHost.setCurrentTab(position);
        widget.setDescendantFocusability(oldFocusability);
 
        // Scroll the current tab into visibility if needed. 
        View tab = widget.getChildTabViewAt(position);
        mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom());
        widget.requestRectangleOnScreen(mTempRect, false);
 
        // Make sure the scrollbars are visible for a moment after selection 
        final View contentView = mTabs.get(position).view;
        if (contentView instanceof CaffeinatedScrollView) {
            ((CaffeinatedScrollView) contentView).awakenScrollBars();
        } 
6
CodeRank
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
            // also takes care of putting focus on it when not in touch mode. 
            // The jerk. 
            // This hack tries to prevent this from pulling focus out of our 
            // ViewPager. 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
            // also takes care of putting focus on it when not in touch mode. 
            // The jerk. 
            // This hack tries to prevent this from pulling focus out of our 
            // ViewPager. 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:setDescendantFocusability, setFormatter, setMaxValue, setMinValue, setValue
    // On create dialog view 
 
    @Override 
    protected View onCreateDialogView()
    { 
	mPicker = new NumberPicker(getContext());
 
	mPicker.setMaxValue(mMaxValue);
	mPicker.setMinValue(mMinValue);
	mPicker.setValue(mValue);
 
	mPicker.setFormatter(new NumberPicker.Formatter()
	    { 
		@SuppressLint("DefaultLocale") 
		@Override 
		public String format(int value)
		{ 
		    return String.format("%dHz", value);
		} 
	    }); 

6
CodeRank
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
            // also takes care of putting focus on it when not in touch mode. 
            // The jerk. 
            // This hack tries to prevent this from pulling focus out of our 
            // ViewPager. 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
         
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
			// also takes care of putting focus on it when not in touch mode. 
			// The jerk. 
			// This hack tries to prevent this from pulling focus out of our 
			// ViewPager. 
			TabWidget widget = mTabHost.getTabWidget();
			int oldFocusability = widget.getDescendantFocusability();
			widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
			mTabHost.setCurrentTab(position);
			widget.setDescendantFocusability(oldFocusability);
 
		} 
 
		public void onPageScrollStateChanged(int state) {
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getDescendantFocusability, setDescendantFocusability
            // also takes care of putting focus on it when not in touch mode. 
            // The jerk. 
            // This hack tries to prevent this from pulling focus out of our 
            // ViewPager. 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
         
    } 
     
} 
5
CodeRank

Related ViewGroup setDescendantFocusability Questions & Answers:

setDescendantFocusability Method Overview
Set the descendant focusability of this view group.
See Code Examples for other Android ViewGroup Methods: