android.widget.ImageButton# setFocusable ( ) 源码实例Demo

下面列出了android.widget.ImageButton# setFocusable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GravityBox   文件: AppPickerPreference.java

@Override
protected void onBindView(View view) {
    super.onBindView(view);

    LinearLayout widgetFrameView = ((LinearLayout) view.findViewById(android.R.id.widget_frame));
    mBtnAppIcon = new ImageButton(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mAppIconPreviewSizePx, mAppIconPreviewSizePx);
    lp.gravity = Gravity.CENTER;
    mBtnAppIcon.setLayoutParams(lp);
    mBtnAppIcon.setScaleType(ScaleType.CENTER_CROP);
    mBtnAppIcon.setImageDrawable(mAppInfo.icon);
    mBtnAppIcon.setFocusable(false);
    if (mIconPickerEnabled) {
        mBtnAppIcon.setOnClickListener(this);
        mBtnAppIcon.setOnLongClickListener(this);
    } else {
        mBtnAppIcon.setEnabled(false);
    }
    widgetFrameView.addView(mBtnAppIcon);
    widgetFrameView.setVisibility(View.VISIBLE);
}
 

private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);
        tab.setSelected(position == currentPosition);
    }
 
源代码3 项目: Popeens-DSub   文件: AlbumView.java

public AlbumView(Context context, boolean cell) {
	super(context);

	if(cell) {
		LayoutInflater.from(context).inflate(R.layout.album_cell_item, this, true);
	} else {
		LayoutInflater.from(context).inflate(R.layout.album_list_item, this, true);
	}

	coverArtView = findViewById(R.id.album_coverart);
	listenedView = (ImageView) findViewById(R.id.album_listened);
	titleView = (TextView) findViewById(R.id.album_title);
	artistView = (TextView) findViewById(R.id.album_artist);

	ratingBar = (RatingBar) findViewById(R.id.album_rating);
	ratingBar.setFocusable(false);
	starButton = (ImageButton) findViewById(R.id.album_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);

	sqlh  = new SQLiteHandler(context);

	checkable = true;
}
 
源代码4 项目: Popeens-DSub   文件: PodcastChannelView.java

public PodcastChannelView(Context context, ImageLoader imageLoader, boolean largeCell) {
	super(context);

	this.imageLoader = imageLoader;
	if(imageLoader != null) {
		LayoutInflater.from(context).inflate(largeCell ? R.layout.basic_cell_item : R.layout.basic_art_item, this, true);
	} else {
		LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);
	}

	titleView = (TextView) findViewById(R.id.item_name);

	starButton = (ImageButton) findViewById(R.id.item_star);
	if(starButton != null) {
		starButton.setFocusable(false);
	}
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			v.showContextMenu();
		}
	});
	coverArtView = findViewById(R.id.item_art);
}
 
源代码5 项目: Popeens-DSub   文件: SongView.java

public SongView(Context context) {
	super(context);
	LayoutInflater.from(context).inflate(R.layout.song_list_item, this, true);

	trackTextView = (TextView) findViewById(R.id.song_track);
	titleTextView = (TextView) findViewById(R.id.song_title);
	artistTextView = (TextView) findViewById(R.id.song_artist);
	durationTextView = (TextView) findViewById(R.id.song_duration);
	statusTextView = (TextView) findViewById(R.id.song_status);
	statusImageView = (ImageView) findViewById(R.id.song_status_icon);
	ratingBar = (RatingBar) findViewById(R.id.song_rating);
	starButton = (ImageButton) findViewById(R.id.song_star);
	starButton.setFocusable(false);
	bookmarkButton = (ImageButton) findViewById(R.id.song_bookmark);
	bookmarkButton.setFocusable(false);
	playedButton = (ImageButton) findViewById(R.id.song_played);
	moreButton = (ImageView) findViewById(R.id.item_more);
	bottomRowView = findViewById(R.id.song_bottom);
}
 
源代码6 项目: Pimp_my_Z1   文件: PagerSlidingTabStrip.java

private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);

    }
 

private void initActivity() {
    // assume the recorder is not running until we are notified otherwise
    mRecorderRunning = false;

    setContentView(R.layout.activity_main);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    mMediaProjectionManager = (MediaProjectionManager)
                                    getSystemService(Context.MEDIA_PROJECTION_SERVICE);

    ImageView iv = findViewById(R.id.power_toggle);
    iv.setOnClickListener(this);
    iv.setOnFocusChangeListener(this);
    iv.setFocusable(true);
    iv.requestFocus();

    ImageButton ib = findViewById(R.id.settingsButton);
    ib.setOnClickListener(this);
    ib.setOnFocusChangeListener(this);
    ib.setFocusable(true);

    setImageViews(mRecorderRunning, false);

    LocalBroadcastManager.getInstance(this).registerReceiver(
            mMessageReceiver, new IntentFilter(BROADCAST_FILTER));

    // request an update on the running status
    checkForInstance();
}
 
源代码8 项目: talkback   文件: SearchScreenOverlay.java

/** Disables the {@code button} and applies the grey-out effect. */
private static void disableImageButton(@Nullable ImageButton button) {
  if (button == null) {
    return;
  }

  button.setEnabled(false);
  // Set focusable to false to prevent receiving focus.
  button.setFocusable(false);
  // Apply grey out effect.
  button.setImageAlpha(0x50);
}
 
源代码9 项目: talkback   文件: SearchScreenOverlay.java

/** Enables the {@code button} and removes the grey-out effect. */
private static void enableImageButton(@Nullable ImageButton button) {
  if (button == null) {
    return;
  }

  button.setEnabled(true);
  // Set focusable to true to receive focus.
  button.setFocusable(true);
  // Remove grey out effect.
  button.setImageAlpha(0xFF);
}
 
源代码10 项目: Popeens-DSub   文件: ArtistEntryView.java

public ArtistEntryView(Context context) {
      super(context);
      LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

      titleView = (TextView) findViewById(R.id.item_name);
starButton = (ImageButton) findViewById(R.id.item_star);
starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.item_more);
moreButton.setOnClickListener(new View.OnClickListener() {
	public void onClick(View v) {
		v.showContextMenu();
	}
});
  }
 
源代码11 项目: Popeens-DSub   文件: ShareView.java

public ShareView(Context context) {
	super(context, false);
	LayoutInflater.from(context).inflate(R.layout.complex_list_item, this, true);

	titleView = (TextView) findViewById(R.id.item_name);
	descriptionView = (TextView) findViewById(R.id.item_description);
	starButton = (ImageButton) findViewById(R.id.item_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			v.showContextMenu();
		}
	});
}
 
源代码12 项目: Popeens-DSub   文件: BasicListView.java

public BasicListView(Context context) {
	super(context, false);
	LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

	titleView = (TextView) findViewById(R.id.item_name);
	starButton = (ImageButton) findViewById(R.id.item_star);
	starButton.setFocusable(false);
	moreButton = (ImageView) findViewById(R.id.item_more);
	moreButton.setVisibility(View.GONE);
}
 
源代码13 项目: Popeens-DSub   文件: ArtistView.java

public ArtistView(Context context) {
      super(context);
      LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true);

      titleView = (TextView) findViewById(R.id.item_name);
starButton = (ImageButton) findViewById(R.id.item_star);
starButton.setFocusable(false);
moreButton = (ImageView) findViewById(R.id.item_more);
moreButton.setOnClickListener(new View.OnClickListener() {
	public void onClick(View v) {
		v.showContextMenu();
	}
});
  }
 

private void initView(View view) {

        tv = (ImageButton) view.findViewById(R.id.local_tv);
        tour = (ImageButton) view.findViewById(R.id.local_tour);
        ad1 = (ImageButton) view.findViewById(R.id.local_ad1);
        ad2 = (ImageButton) view.findViewById(R.id.local_ad2);
        cate = (ImageButton) view.findViewById(R.id.local_cate);
        weather = (ImageButton) view.findViewById(R.id.local_weather);
        news = (ImageButton) view.findViewById(R.id.local_news);
        appStore = (ImageButton) view.findViewById(R.id.local_app_store);
        video = (ImageButton) view.findViewById(R.id.local_video);

        tv.setOnFocusChangeListener(mFocusChangeListener);
        tour.setOnFocusChangeListener(mFocusChangeListener);
        ad1.setOnFocusChangeListener(mFocusChangeListener);
        ad2.setOnFocusChangeListener(mFocusChangeListener);
        cate.setOnFocusChangeListener(mFocusChangeListener);
        weather.setOnFocusChangeListener(mFocusChangeListener);
        news.setOnFocusChangeListener(mFocusChangeListener);
        appStore.setOnFocusChangeListener(mFocusChangeListener);
        video.setOnFocusChangeListener(mFocusChangeListener);

        tv.setOnClickListener(this);
        video.setOnClickListener(this);

        tv.setFocusable(true);
        tv.setFocusableInTouchMode(true);
        tv.requestFocus();
        tv.requestFocusFromTouch();
    }
 
源代码15 项目: KitKatEmoji   文件: PagerSlidingTabStrip.java

private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setImageResource(resId);
        tab.setFocusable(true);
        addTab(position, tab);
        tab.setSelected(position == currentPosition);
    }
 
源代码16 项目: zen4android   文件: ZenMenuAdapter.java

@Override
public View getGroupView(int groupPosition, boolean isExpanded,
		View convertView, ViewGroup parent) {
	Map<String, String> map = (Map<String, String>)mHeaders.get(groupPosition);
	String text = (String)map.get("name");
	if(convertView == null) {
		convertView = mInflater.inflate(R.layout.zen_menu_group, null);			
	}
	ImageButton itemLeft = (ImageButton)convertView.findViewById(R.id.zen_menu_header_left);
	Button itemRight = (Button)convertView.findViewById(R.id.zen_menu_header_right);
	itemRight.setText(text);
	
	itemLeft.setImageResource(R.drawable.menu_right_arrow);
	if(isExpanded) {
		itemLeft.setImageResource(R.drawable.menu_down_arrow);
	}
	
	int background = menu_item_backgrounds[groupPosition%9];
	itemLeft.setBackgroundResource(background);
	itemRight.setBackgroundResource(background);
	itemLeft.setFocusable(false);
	itemRight.setFocusable(false);
	itemLeft.setClickable(false);
	itemRight.setClickable(false);
	
	
	
	return convertView;
}