android.widget.ImageView.setFocusable()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中android.widget.ImageView.setFocusable()方法的一些代码示例,展示了ImageView.setFocusable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setFocusable()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setFocusable

ImageView.setFocusable介绍

暂无

代码示例

代码示例来源:origin: Yalantis/Side-Menu.Android

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
  View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  mImageView = (ImageView) rootView.findViewById(R.id.image_content);
  mImageView.setClickable(true);
  mImageView.setFocusable(true);
  mImageView.setImageResource(res);
  return rootView;
}

代码示例来源:origin: stackoverflow.com

public View getView(int position, View covertView, ViewGroup parent) {
   LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   View rowView = inflater.inflate(R.layout.cat_select, parent, false);
   TextView textView = (TextView) rowView.findViewById(R.id.cat_name);
   Category catToDisplay = categories.get(position);
   textView.setText(catToDisplay.getName());
   if(catToDisplay.isParent()) {
     ImageView imageView = (ImageView) rowView.findViewById(R.id.cstrow_cat_expand);
     imageView.setImageResource(R.drawable.cat_expand);
     imageView.setOnClickListener(categoryExpandClickHandler);
     imageView.setOnTouchListener(categoryExpandTouchHandler);
     imageView.setFocusable(false); // to make sure the highlight on the item shows
     imageView.setFocusableInTouchMode(false); // to make sure the highlight on the item shows
     imageView.setTag(catToDisplay);
   }
   return rowView;
 }

代码示例来源:origin: andreadec/MusicPlayer

public PlaylistViewHolder(View view, MainActivity activity, final ListsClickListener clickListener) {
  super(view);
  this.activity = activity;
  this.clickListener = clickListener;
  name = (TextView)view.findViewById(R.id.textViewName);
  menu = (ImageButton)view.findViewById(R.id.buttonMenu);
  view.setOnClickListener(this);
  menu.setOnClickListener(this);
  menu.setFocusable(false);
}

代码示例来源:origin: stackoverflow.com

imageView.setFocusable(false);
imageView.setFocusableInTouchMode(false);
imageView.setClickable(true);

代码示例来源:origin: SiberiaDante/TitleLayout

/**
 * 设置左侧图片是否可以点击
 */
public void setLeftImageClickable(boolean isClickable) {
  mIvLeft.setClickable(isClickable);
  mIvLeft.setFocusable(isClickable);
}

代码示例来源:origin: Hankkin/GradationTitleBar

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().requestFeature(Window.FEATURE_NO_TITLE);
  StatusBarUtil.setImgTransparent(this);
  setContentView(R.layout.activity_qqspeak);
  scrollView = (GradationScrollView) findViewById(R.id.scrollview);
  listView = (ListView) findViewById(R.id.listview);
  textView = (TextView) findViewById(R.id.textview);
  ivBanner = (ImageView) findViewById(R.id.iv_banner);
  ivBanner.setFocusable(true);
  ivBanner.setFocusableInTouchMode(true);
  ivBanner.requestFocus();
  initListeners();
  initData();
}

代码示例来源:origin: SiberiaDante/TitleLayout

/**
 * 设置右侧图片是否可以点击
 */
public void setRightImageClickable(boolean isClickable) {
  mIvRight.setClickable(isClickable);
  mIvRight.setFocusable(isClickable);
}

代码示例来源:origin: stackoverflow.com

final ImageView img = (ImageView)findViewById(R.id.imageView1);
img.setClickable(true);
img.setFocusable(true);
img.setOnClickListener(new View.OnClickListener(){
  ...

代码示例来源:origin: andreadec/MusicPlayer

public void update(final Podcast podcast) {
  this.podcast = podcast;
  title.setText(podcast.getName());
  Bitmap podcastImage = podcast.getImage();
  if(podcastImage!=null) {
    image.setImageBitmap(podcastImage);
  }
  menu.setOnClickListener(this);
  menu.setFocusable(false);
}

代码示例来源:origin: stackoverflow.com

Try this (things in *** .... ****)
......
public void populateDataForRow(View parentView, ContactItemInterface item,
      int position) {
    // default just draw the item only
    View infoView = parentView.findViewById(R.id.infoRowContainer);
    infoView.setTag(position);
    TextView fullNameView = (TextView) infoView.findViewById(R.id.tv_name);
    View tv_grey = infoView.findViewById(R.id.tv_grey);
    View tv_green = infoView.findViewById(R.id.tv_green);
    View tv_red = infoView.findViewById(R.id.tv_red);
    View tv_yellow = infoView.findViewById(R.id.tv_yellow);
    ImageView iv_user = (ImageView) infoView.findViewById(R.id.im_calls);
    View pending_cont = infoView.findViewById(R.id.pending_cont);
    ImageView btnInfo = (ImageView)infoView.findViewById(R.id.btn_info);
    ****btnInfo.setFocusable(false);****
    if(btnInfo != null){
      btnInfo.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
          Toast.makeText(getContext(), "Button", Toast.LENGTH_SHORT).show();
        }
      });
    }
....... // Your code

代码示例来源:origin: andreadec/MusicPlayer

menu.setFocusable(false);

代码示例来源:origin: li2/learning-android-open-source

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.animations_main_screen);
  mPhotosList = (ListView) findViewById(android.R.id.list);
  mImageView = (ImageView) findViewById(R.id.picture);
  mContainer = (ViewGroup) findViewById(R.id.container);
  // Prepare the ListView
  final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
      android.R.layout.simple_list_item_1, PHOTOS_NAMES);
  mPhotosList.setAdapter(adapter);
  mPhotosList.setOnItemClickListener(this);
  // Prepare the ImageView
  mImageView.setClickable(true);
  mImageView.setFocusable(true);
  mImageView.setOnClickListener(this);
  // Since we are caching large views, we want to keep their cache
  // between each animation
  mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.animations_main_screen);
  mPhotosList = (ListView) findViewById(android.R.id.list);
  mImageView = (ImageView) findViewById(R.id.picture);
  mContainer = (ViewGroup) findViewById(R.id.container);
  // Prepare the ListView 准备ListView
  final ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
      android.R.layout.simple_list_item_1, PHOTOS_NAMES);
  mPhotosList.setAdapter(adapter);
  mPhotosList.setOnItemClickListener(this);
  // 准备ImageView
  mImageView.setClickable(true);
  mImageView.setFocusable(true);
  mImageView.setOnClickListener(this);
  //因为我们缓存大观点,我们想保持他们的缓存
  //每个动画之间
  mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
}

代码示例来源:origin: grzegorznittner/chanu

playPauseReplayView.setBackgroundResource(R.drawable.bg_vidcontrol);
playPauseReplayView.setScaleType(ScaleType.CENTER);
playPauseReplayView.setFocusable(true);
playPauseReplayView.setClickable(true);
playPauseReplayView.setOnClickListener(this);

代码示例来源:origin: abrenoch/hyperion-android-grabber

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  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();
  setImageViews(mRecorderRunning, false);
  LocalBroadcastManager.getInstance(this).registerReceiver(
      mMessageReceiver, new IntentFilter(HyperionScreenService.BROADCAST_FILTER));
  checkForInstance();
}

代码示例来源:origin: derry/delion

mIconView.getLayoutParams().width = mSmallIconSize;
mIconView.getLayoutParams().height = mSmallIconSize;
mIconView.setFocusable(false);

代码示例来源:origin: wintonBy/BottomNavigationView

private void init(){
  tvTitle = new TextView(getContext());
  initTitle();
  ivIcon = new ImageView(getContext());
  ivIcon.setId(R.id.icon);
  initIcon();
  reminderView = new TextView(getContext());
  initRemindView();
  this.setFocusable(true);
  tvTitle.setFocusable(false);
  ivIcon.setFocusable(false);
  reminderView.setFocusable(false);
}

代码示例来源:origin: stackoverflow.com

r1.setOnTouchListener(this);
iv2.setFocusable(true);

代码示例来源:origin: mnnyang/ClassSchedule

iv.setBackground(pressedSelector);
iv.setClickable(true);
iv.setFocusable(true);

代码示例来源:origin: abrenoch/hyperion-android-grabber

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();
}

相关文章

ImageView类方法