ViewGroup hasFocus - 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 hasFocus method.

This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, clearFocus, hasFocus, getValue
6
CodeRank
This code example shows how to use the following methods:requestFocus, hasFocus
    } 
     
     
    @Test 
    public void hasFocus_shouldReturnTrueIfAnyChildHasFocus() throws Exception { 
        assertFalse(root.hasFocus());
 
        child1.requestFocus();
        assertTrue(root.hasFocus());
 
        child1.clearFocus();
        assertFalse(root.hasFocus());
 
        child3b.requestFocus();
        assertTrue(root.hasFocus());
 
        child3b.clearFocus();
        assertFalse(root.hasFocus());
 
        root.requestFocus();

6
CodeRank
This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, clearFocus, hasFocus, getValue
6
CodeRank
This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, clearFocus, hasFocus, getValue
6
CodeRank

Related ViewGroup hasFocus Questions & Answers:

hasFocus Method Overview
Returns true if this view has or contains focus
See Code Examples for other Android ViewGroup Methods: