本文整理了Java中android.widget.ImageButton.<init>()
方法的一些代码示例,展示了ImageButton.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.<init>()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:<init>
暂无
代码示例来源:origin: JohnPersano/SuperToasts
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
代码示例来源:origin: joyoyao/superCleanMaster
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
代码示例来源:origin: stackoverflow.com
public void init(){
TableLayout ll = (TableLayout) findViewById(R.id.displayLinear);
for (int i = 0; i <2; i++) {
TableRow row= new TableRow(this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(lp);
checkBox = new CheckBox(this);
tv = new TextView(this);
addBtn = new ImageButton(this);
addBtn.setImageResource(R.drawable.add);
minusBtn = new ImageButton(this);
minusBtn.setImageResource(R.drawable.minus);
qty = new TextView(this);
checkBox.setText("hello");
qty.setText("10");
row.addView(checkBox);
row.addView(minusBtn);
row.addView(qty);
row.addView(addBtn);
ll.addView(row,i);
}
}
代码示例来源:origin: rockerhieu/emojicon
private void addTabIcon(EmojiconPage page, int index) {
ImageButton icon = new ImageButton(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT);
params.weight = 1;
icon.setBackground(null);
icon.setScaleType(ImageView.ScaleType.CENTER);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
icon.setImageDrawable(getContext().getResources().getDrawable(page.getIcon()));
} else {
icon.setImageDrawable(getContext().getDrawable(page.getIcon()));
}
mTabsContainer.addView(icon, mTabsContainer.getChildCount() - 2, params);
mTabs[index] = icon;
final int indexToMove = index;
icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mViewPager.setCurrentItem(indexToMove, true);
}
});
}
代码示例来源:origin: stackoverflow.com
//assuming you have a friendsView object that is some sort of Layout.
Button yourButton = new ImageButton(this);
//do stuff like add text and listeners.
friendsView.addView(yourButton);
代码示例来源:origin: stackoverflow.com
ImageButton imageButton = new ImageButton(this);
imageButton.setBackgroundDrawable(null);
代码示例来源:origin: stackoverflow.com
LinearLayout lp=new LinearLayout(this);
lp.addView(new Button(this));
lp.addView(new ImageButton(this));
//Now remove them
lp.removeViewAt(0); // and so on
代码示例来源:origin: guolindev/giffun
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
代码示例来源:origin: tianshaojie/AndroidFine
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
代码示例来源:origin: stackoverflow.com
protected void Page_Load(object sender, EventArgs ea)
{
ImageButton testbtn = new ImageButton();
testbtn.OnClientClick = "return testbook('15000')";
form1.Controls.Add(testbtn);
}
代码示例来源:origin: Tencent/RapidView
@Override
protected View createView(Context context){
return new ImageButton(context);
}
}
代码示例来源:origin: stackoverflow.com
ImageButton[] btnGreen = new ImageButton[3];
for (int i = 0; i < 3; i++) {
btnGreen[i] = new ImageButton(this);
btnGreen[i].setImageResource(R.drawable.bola_verde);
btnGreen[i].setLayoutParams(lp);
btnGreen[i].setOnClickListener(ClickListener);
btnGreen[i].setBackgroundColor(Color.TRANSPARENT);
btnGreen[i].setTag(i);
btnGreen[i].setId(i);
gameBoard.addView(btnGreen[i]);
}
代码示例来源:origin: stackoverflow.com
ImageButton img = new ImageButton(this);
//set img's image to the fb like image
img.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent open = new Intent(Intent.ACTION_VIEW, Uri.parse("http://..."));
startActivity(open);
}
});
代码示例来源:origin: stackoverflow.com
TextView tv = new TextView(this);
tv.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
ImageButton imb=new ImageButton(this);
imb.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
ll.addView(imb);
ll.addView(tv);
代码示例来源:origin: stackoverflow.com
final ImageButton btnx = new ImageButton(this);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
50, 50);
layoutParams.setMargins(14, 14, 14, 14);
l5.addView(btnx, layoutParams);
btnx.setImageResource(R.drawable.buttonx);
代码示例来源:origin: stackoverflow.com
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT) <---
lp.gravity = Gravity.RIGHT; <---
Button projectButton = new Button(this);
projectButton.setText(projectName);
projectButton.setLayoutParams(lp); <---
lp.gravity = Gravity.LEFT; <---
ImageButton playButton = new ImageButton(this);
playButton.setImageResource(R.drawable.ic_action_play_over_video);
playButton.setLayoutParams(lp); <---
代码示例来源:origin: lovejjfg/Circle
private void addIconTab(final int position, int resId) {
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
addTab(position, tab);
}
代码示例来源:origin: vanilla-music/vanilla
/**
* Returns a new image button to be placed on the bar
*
* @param drawable The icon to use
*/
private ImageButton getImageButton(Drawable drawable) {
ImageButton button = new ImageButton(mContext);
button.setImageDrawable(drawable);
button.setBackgroundResource(R.drawable.unbound_ripple_light);
return button;
}
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < RenaissanceDatabase.description[].length; i++) {
ImageButton btn = new ImageButton(this);
int id = getResources().getIdentifier("yourpackagename:drawable/painting" + (i+1), null, null);
btn.setImageDrawable(getResources().getDrawable(
id));
btn.setContentDescription(RenaissanceDatabase.description[i]);
mLinearList.addView(btn);
}
代码示例来源:origin: stackoverflow.com
for(int but=0; but<ClueList.size(); but++){
ImageButton clueBut = new ImageButton(this);
clueBut.setBackgroundResource(0);
clueBut.setImageBitmap(ClueList.get(but).btmp);
clueBut.setId(but);
//clueBut.setOnClickListener(this);
tr0.addView(clueBut);
}
内容来源于网络,如有侵权,请联系作者删除!