View setFocusable - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, setLayoutParams, setOnKeyListener, getImeOptions
This code example shows how to use the following methods:setAlpha, setClickable, setEnabled, setFocusable
This code example shows how to use the following methods:requestFocus, setFocusable, setFocusableInTouchMode, setId, setLayoutParams
    public boolean actionIdentifierUp = false;
    public boolean actionIdentifierDown = false;
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        View layout = new LinearLayout(this);
        layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        layout.setId(CONTENT_VIEW_ID);
 
        layout.setOnKeyListener(new OnKeyListener() {
 
            @Override 
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                keyIdentifier = keyCode;
 
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    actionIdentifierDown = true;
                else if (event.getAction() == KeyEvent.ACTION_UP)
                    actionIdentifierUp = true;
                return true; 

7
CodeRank
This code example shows how to use the following methods:getHolder, setFocusable, setFocusableInTouchMode, setOnTouchListener
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		mPreview = new SurfaceView(this);
		setContentView(mPreview);
		 
		init(); 
		 
		initViews(); 
	} 
	 
	private void initViews() { 
		mPreview.setFocusable(true);
		mPreview.setFocusableInTouchMode(true);
		mPreview.setOnTouchListener(this);
		 
		/* 得到SurfaceHolder对象 */ 
		mHolder = mPreview.getHolder();

7
CodeRank
This code example shows how to use the following methods:setFocusable, setEnabled
        } 
    } 
 
    private void updateSendButton() { 
        if (null != mSendButton) {
            mSendButton.setEnabled(mCanSend);
            mSendButton.setFocusable(mCanSend);
        } 
    } 
 
    public void hideView() { 
        if (mView != null) {
            ((View)mView).setVisibility(View.GONE);
        } 
    } 
 
    private View getStubView(int stubId, int viewId) {
        View view = findViewById(viewId);
        if (view == null) {
            ViewStub stub = (ViewStub) findViewById(stubId);
7
CodeRank
This code example shows how to use the following methods:setFocusable, setFocusableInTouchMode, setId, setLayoutParams, setPadding
     * @param toLeftOf Align the new textview to the right of the argument 
     * @return TextView The that represents the digit 
     */ 
    private TextView createTimerDigit(int id, int textSize, TextView toRigthOf) {
        // Create the TextView 
        TextView digit = new TextView(getContext());
        digit.setId(id);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        if (toRigthOf != null) {
            params.addRule(RelativeLayout.RIGHT_OF, toRigthOf.getId());
            params.addRule(RelativeLayout.ALIGN_BASELINE, toRigthOf.getId());
        } 
        digit.setLayoutParams(params);
        digit.setPadding(0, this.mPadding, 0, this.mPadding);
        digit.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
        digit.setTextColor(this.mColor);
        digit.setFocusable(false);
        digit.setFocusableInTouchMode(false);

7
CodeRank
This code example shows how to use the following methods:setClickable, setEnabled, setFocusable, setMax, setProgress
	/** 
	 * Set up the slide bar to adjust the opacity of the front image 
	 */ 
	private void setupSeekBar() 
	{ 
		seekBarOpacity.setEnabled(true);
		seekBarOpacity.setFocusable(true);
		seekBarOpacity.setClickable(true);
 
		// 255 is the maximum opacity of a drawable 
		seekBarOpacity.setMax(255);		
 
		// Set the default opacity to 70 
		seekBarOpacity.setProgress(70);
		imageView.setAlpha(70);
 
		seekBarOpacity.setOnSeekBarChangeListener( new OnSeekBarChangeListener() {
 
			@Override 
			public void onStopTrackingTouch(SeekBar seekBar) {

6
CodeRank
This code example shows how to use the following methods:setClickable, setFocusable, setFocusableInTouchMode, setMinimumHeight, setMinimumWidth
		num = n;
	} 
 
	// create a new ImageView for each item referenced by the Adapter 
    public View getView(int position, View convertView, ViewGroup parent) {
    	LinearLayout l = new LinearLayout(context);
    	l.setMinimumHeight(250);
    	l.setMinimumWidth(150);
    	ProgressBar s = new ProgressBar(context);
    	l.setGravity(Gravity.CENTER);
    	l.addView(s);
    	 
    	l.setFocusable(false);
    	l.setFocusableInTouchMode(false);
    	l.setClickable(false);
 
    	s.setFocusable(false);
    	s.setFocusableInTouchMode(false);
    	s.setClickable(false);
    	 
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 View setFocusable Questions & Answers:

setFocusable Method Overview
Set whether this view can receive the focus.
See Code Examples for other Android View Methods: