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

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

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

ImageButton.setFocusable介绍

暂无

代码示例

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

@Override
 public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   if (convertView == null) {
     LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     convertView = inflater.inflate(R.layout.elv_group, null);
   }
   TextView tvItem = (TextView) convertView.findViewById(R.id.tvRecipeName);
   ImageButton ibDeleteRcipe = (ImageButton) convertView.findViewById(R.id.ibDeleteRecipe);
   ibDeleteRcipe.setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {               
       ...
     }
   });
   ibDeleteRcipe.setFocusable(false);
   tvItem.setText(arrGroupElements[groupPosition]);
   return convertView;
 }

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

public View getView(final int position, View convertView, ViewGroup parent) {

  if (convertView == null)
    convertView = LayoutInflater.from(context).inflate(R.layout.alvappliances, parent, false);

  ImageButton delete = (ImageButton)convertView.findViewById(R.id.alvaDeleteIB);

  delete.setFocusable(false);
  delete.setFocusableInTouchMode(false);

  return convertView;
}

代码示例来源:origin: scola/Qart

public void shouldUseFloatingActionButton(boolean shouldUseFloatingActionButton) {
  this.shouldUseFloatingActionButton = shouldUseFloatingActionButton;
  if (shouldUseFloatingActionButton) {
    this.fab.setVisibility(View.VISIBLE);
    this.setDividerVisibility(View.GONE);
    this.shouldDarkenButtonsLayout(false);
    this.btnFinish.setVisibility(View.GONE);
    this.btnSkip.setVisibility(View.GONE);
    this.ibNext.setVisibility(View.GONE);
    this.ibNext.setFocusable(false);
    this.buttonsLayout.getLayoutParams().height =
        (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96,
            getResources().getDisplayMetrics());
  }
}

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

ImageButton callBackButton = (ImageButton) row.findViewById(R.id.callBackBtn);
callBackButton.setFocusable(false);

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

ImageButton button = (ImageButton) convertView.findViewById(R.id.imageButton);
button.setFocusable(false);

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

final ImageButton imgBtn=(ImageButton) rowView.findViewById(R.id.imgBtn);
 imgBtn.setFocusable(false);
 imgBtn.setOnClickListener(new OnClickListener() {
   @Override
   public void onClick(View v) {
     //do your task here
   }
 });

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

final ImageButton imgBtn=(ImageButton) rowView.findViewById(R.id.imgBtn);
 imgBtn.setFocusable(false);
 imgBtn.setOnClickListener(new OnClickListener() {
   @Override
   public void onClick(View v) {
     //do your task here
   }
 });

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

ImageButton imgbutton = (ImageButton) convertView.findViewById(R.id.ibDeleteRecipe);
   imgbutton .setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {               
       ...
     }
   });
   imgbutton .setFocusable(false);

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

public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {

  if (view == null) 
  {
    view = inflater.inflate(R.layout.layout_channelwithimage, viewGroup, false);
  }

  TextView textView = (TextView) view.findViewById(R.id.labelwithimage);
  textView.setText(getGroup(i).toString());

  ImageButton imbu = (ImageButton) view.findViewById(R.id.imageButton);
  //imbu.setOnClickListener(this);    
  imbu.setFocusable(false);

  return view;
}

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

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

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

public RadioViewHolder(View view, MainActivity activity, ListsClickListener clickListener) {
  super(view);
  text = (TextView)view.findViewById(R.id.textViewRadio);
  image = (ImageView)view.findViewById(R.id.imageViewRadio);
  menu = (ImageButton)view.findViewById(R.id.buttonMenu);
  card = view.findViewById(R.id.card);
  this.activity = activity;
  this.clickListener = clickListener;
  view.setOnClickListener(this);
  menu.setOnClickListener(this);
  menu.setFocusable(false);
}

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

public SearchResultsViewHolder(View view) {
  super(view);
  title = (TextView)view.findViewById(R.id.textViewSongItemTitle);
  artist = (TextView)view.findViewById(R.id.textViewSongItemArtist);
  image = (ImageView)view.findViewById(R.id.imageViewItemImage);
  menu = (ImageButton)view.findViewById(R.id.buttonMenu);
  view.setOnClickListener(this);
  menu.setOnClickListener(this);
  menu.setFocusable(false);
}

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

public SongViewHolder(View view, ImagesCache imagesCache, ListsClickListener clickListener) {
  super(view);
  title = (TextView)view.findViewById(R.id.textViewSongItemTitle);
  artist = (TextView)view.findViewById(R.id.textViewSongItemArtist);
  image = (ImageView)view.findViewById(R.id.imageViewItemImage);
  menu = (ImageButton)view.findViewById(R.id.buttonMenu);
  card = view.findViewById(R.id.card);
  this.imagesCache = imagesCache;
  this.clickListener = clickListener;
  view.setOnClickListener(this);
  menu.setOnClickListener(this);
  menu.setFocusable(false);
}

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

@Override
protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) {
  TextView text_line1 = (TextView) view.findViewById(R.id.work_list_group_view);
  text_line1.setText("title1");

  TextView text_line2 = (TextView) view.findViewById(R.id.work_list_group_view2);
  text_line2.setText("title2");

  ImageButton button = (ImageButton) view.findViewById(R.id.context_menu_button);
  // Magic comes here, you should add:
  button.setFocusable(false); // ListItem is not clickable if it has focusable child's.
  button.setOnClickListener(new OnClickListener(){ ... });

}

@Override
public View newGroupView(Context context, Cursor cursor,
    boolean isExpanded, ViewGroup parent) {
  return getLayoutInflater().inflate(R.layout.work_list_expandable_group, parent, false);
}

代码示例来源:origin: Qiang3570/PageSlidingTab

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

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

@Override
public void bindView(View view, final Context context, Cursor cursor) {
  TextView name = (TextView) view.findViewById(R.id.text_box_name);
  name.setText(cursor.getString(cursor
    .getColumnIndex(DatabaseContract.BoxEntry.NAME)));
  name.setFocusable(false);
  ImageButton delete = (ImageButton) view.findViewById(R.id.button_box_delete);
  delete.setFocusable(false);
  delete.setTag(cursor.getLong(0));
  delete.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View view) {
      long id = ((Long) view.getTag());
      context.getContentResolver().delete(uri...);
    }
  });

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

setListAdapter(new ArrayAdapter<Object>(this, R.layout.row, R.id.Browse_DateTime, ourRows) {
   @Override
   public View getView(int position, View convertView, ViewGroup parent) {
     View v = convertView;
     if (v == null) {
       LayoutInflater vi = (LayoutInflater)BrowseActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       v = vi.inflate(R.layout.row, null);  
     }    
     TextView time = (TextView) v.findViewById (R.id.Browse_DateTime);
     time.setText(ourRows[position].dateTime);
     ImageButton delete = (ImageButton) v.findViewById(R.id.delete);
     delete.setFocusable(false);
     delete.setImageDrawable(BrowseActivity.this.getResources().getDrawable(R.drawable.deletebutton));  
     delete.setOnClickListener(BrowseActivity.this);
     delete.setId(position);
     return v;
   }
 };)

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

public View getView(int position, View convertView, ViewGroup parent) {
   if (convertView == null) { // if it's not recycled, initialize some
                 // attributes
     LayoutInflater li = (LayoutInflater) mContext
         .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     convertView = li.inflate(R.layout.icon_launcher, null);
   } 
   TextView tv = (TextView) convertView.findViewById(R.id.icon_text);
   ImageButton ib = (ImageButton) convertView.findViewById(R.id.icon_image);
   LinearLayout icon = (LinearLayout) convertView
           .findViewById(R.id.icon_launcher);
   // icon.setLayoutParams(new GridView.LayoutParams(203,200));
   ib.setScaleType(ib.getScaleType().FIT_XY);
   ib.setPadding(1, 1, 1, 1);
   ib.setFocusable(false);
   ib.setClickable(false);
   ib.setImageBitmap(BitmapFactory.decodeFile(mThumbIds.get(position)));
       tv.setText(mTextsIds.get(position));
   return convertView;
 }

代码示例来源:origin: avluis/Hentoid

/**
 * Create the button for the given attribute type
 *
 * @param attr Attribute Type the button should represent
 * @return Button representing the given Attribute type
 */
private ImageButton createAttributeSectionButton(AttributeType attr)
{
  ImageButton button = new ImageButton(mContext);
  button.setBackgroundResource(R.drawable.btn_attribute_section_off);
  button.setImageResource(attr.getIcon());
  button.setClickable(true);
  button.setFocusable(true);
  button.setOnClickListener(v -> selectAttrButton(button));
  button.setTag(attr);
  return button;
}

代码示例来源: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();
}

相关文章

ImageButton类方法