本文整理了Java中android.widget.Button.getTag()
方法的一些代码示例,展示了Button.getTag()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getTag()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:getTag
暂无
代码示例来源:origin: lingochamp/FileDownloader
@Override
public void onClick(View v) {
final boolean toStart = (boolean) actionBtn.getTag();
if (toStart) {
if (start()) {
actionBtn.setText(R.string.pause);
actionBtn.setTag(false);
}
} else {
actionBtn.setText(R.string.start);
pause();
actionBtn.setTag(true);
}
}
});
代码示例来源:origin: jaydenxiao2016/AndroidFire
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
selectPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(button, selectPosition);
}
}
});
代码示例来源:origin: jaydenxiao2016/AndroidFire
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
selectPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(button, selectPosition);
}
}
});
代码示例来源:origin: Bilibili/DanmakuFlameMaster
addDanmaKuShowTextAndImage(false);
} else if (v == mBtnSendDanmakus) {
Boolean b = (Boolean) mBtnSendDanmakus.getTag();
timer.cancel();
if (b == null || !b) {
代码示例来源:origin: Bilibili/DanmakuFlameMaster
addDanmaKuShowTextAndImage(false);
} else if (v == mBtnSendDanmakus) {
Boolean b = (Boolean) mBtnSendDanmakus.getTag();
timer.cancel();
if (b == null || !b) {
代码示例来源:origin: rey5137/material
@Override
public void onClick(View v) {
final DatePickerDialog dialog = new DatePickerDialog(getContext(), mDatePickerDialogStyleId);
long minTime = System.currentTimeMillis();
Calendar cal = dialog.getCalendar();
cal.setTimeInMillis(minTime);
cal.add(Calendar.YEAR, 100);
long maxTime = cal.getTimeInMillis();
dialog.dateRange(minTime, maxTime)
.date((long)mEndDateButton.getTag())
.positiveAction(mPositiveAction.getText())
.positiveActionClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
onEndDateChanged(dialog.getDate());
dialog.dismiss();
}
})
.negativeAction(mNegativeAction.getText())
.negativeActionClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
dialog.dismiss();
}
})
.show();
}
};
代码示例来源:origin: rey5137/material
private void onEndSelected(int endMode){
mRecurring.setEndMode(endMode);
mRecurring.setEndSetting(0);
switch (endMode){
case Recurring.END_FOREVER:
animOut(mEndNumEditText, false, false);
animOut(mEndNumUnitTextView, false, false);
animOut(mEndDateButton, false, false);
break;
case Recurring.END_UNTIL_DATE:
animOut(mEndNumEditText, false, true);
animOut(mEndNumUnitTextView, false, true);
animIn(mEndDateButton, false);
mRecurring.setEndDate((Long)mEndDateButton.getTag());
break;
case Recurring.END_FOR_EVENT:
animIn(mEndNumEditText, false);
animIn(mEndNumUnitTextView, false);
animOut(mEndDateButton, false, true);
mRecurring.setEventNumber(Integer.parseInt(mEndNumEditText.getText().toString()));
break;
}
}
代码示例来源:origin: wutongke/AndroidSkinAnimator
private boolean isAnimatorOpen() {
return mDataBinding.toggle.getTag().equals("open");
}
代码示例来源:origin: stackoverflow.com
final Button btn= (Button)v.findViewById(R.id.letterbtn);
// btn.setText(word[position]+"");
btn.setTag(position);
btn.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
// btn.setTag(btn);
String pos=btn.getTag().toString();
//You get a position of that button
Log.e("position",pos);
//You get a word of that position
Log.e("word",""+word[Integer.parseInt(pos)]);
btn.setVisibility(View.GONE);
}
});
代码示例来源:origin: stackoverflow.com
private View rootView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_contatos, container, false);
final Button link1 = (Button)rootView.findViewById(R.id.link1);
link1.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
System.out.println(link1.getTag().toString());
}
});
}
代码示例来源:origin: stackoverflow.com
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Button yourbtn= (Button) v.findViewById(R.id.yourbtnid);
yourbtn.setTag(position);
yourbtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Button btn = (Button)arg0;
int position = Integer.parseInt(btn .getTag().toString());
}
}
代码示例来源:origin: FangWW/ComparisonCar
@Override
public void onClick(View v) {
vht_table.setSelection((Integer) mBtnJump.getTag(), ((int) getResources().getDimension(R.dimen.dimen_title_height)));
int i = random.nextInt(contentAllData.size());
mBtnJump.setText("随机跳转到第" + i);
mBtnJump.setTag(i);
}
});
代码示例来源:origin: weavey/NormalSelectDialog
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
clickPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(NormalSelectionDialog.this, button,
clickPosition);
}
}
});
代码示例来源:origin: weavey/NormalSelectDialog
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
clickPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(MDSelectionDialog.this,button, clickPosition);
}
}
});
代码示例来源:origin: weechatfly/wtoolbatchmsgs
@Override
public void onClick(View v) {
if (buttonStartMessage.getTag().equals(0)) {
try {
JSONObject jsonObject = new JSONObject();
代码示例来源:origin: NightscoutFoundation/xDrip
public void snoozeAdjust(View v) {
final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable
Log.d(TAG, "Snooze adjust button: " + button_text);
long multiplier = Constants.MINUTE_IN_MS;
final String[] button_textA = button_text.split(" ");
switch (button_textA[1].toLowerCase()) {
case "hour":
case "hours":
multiplier = Constants.HOUR_IN_MS;
break;
case "day":
case "days":
multiplier = Constants.DAY_IN_MS;
break;
case "week":
case "weeks":
multiplier = Constants.WEEK_IN_MS;
break;
}
final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier;
Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust);
dismissItem(last_swiped);
snoozeReminder(last_swiped, snooze_adjust);
reinject(last_swiped);
}
代码示例来源:origin: jamorham/xDrip-plus
public void snoozeAdjust(View v) {
final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable
Log.d(TAG, "Snooze adjust button: " + button_text);
long multiplier = Constants.MINUTE_IN_MS;
final String[] button_textA = button_text.split(" ");
switch (button_textA[1].toLowerCase()) {
case "hour":
case "hours":
multiplier = Constants.HOUR_IN_MS;
break;
case "day":
case "days":
multiplier = Constants.DAY_IN_MS;
break;
case "week":
case "weeks":
multiplier = Constants.WEEK_IN_MS;
break;
}
final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier;
Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust);
dismissItem(last_swiped);
snoozeReminder(last_swiped, snooze_adjust);
reinject(last_swiped);
}
代码示例来源:origin: avluis/Hentoid
/**
* Handler for search tag (i.e. selected Attribute appearing near the search bar) button click
*
* @param button Button that has been clicked on
*/
private void selectSearchTag(Button button) {
Attribute a = (Attribute)button.getTag();
selectedSearchTags.remove(a);
searchTags.removeView(button);
// If displayed, change color of the corresponding button in tag suggestions
Button tagButton = attributeMosaic.findViewById(Math.abs(a.getId()));
if (tagButton != null) colorButton(tagButton, TAGFILTER_ACTIVE);
// Launch book search according to new attribute selection
searchLibrary(MODE_MIKAN == mode);
// Update attribute mosaic buttons state according to available metadata
updateAttributeMosaic();
}
代码示例来源:origin: avluis/Hentoid
/**
* Handler for Attribute button click
*
* @param button Button that has been clicked on
*/
private void selectTagSuggestion(Button button) {
Attribute a = (Attribute)button.getTag();
// Add new tag to the selection
if (!selectedSearchTags.contains(a)) {
searchTags.addView(createTagSuggestionButton(a, true));
colorButton(button, TAGFILTER_SELECTED);
selectedSearchTags.add(a);
} else { // Remove selected tag
searchTags.removeView(searchTags.findViewById(Math.abs(a.getId())));
colorButton(button, TAGFILTER_ACTIVE);
selectedSearchTags.remove(a);
}
// Launch book search according to new attribute selection
searchLibrary(MODE_MIKAN == mode);
// Update attribute mosaic buttons state according to available metadata
updateAttributeMosaic();
}
代码示例来源:origin: ashishbhandari/RetailStore
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.cartButt:
MyCart mycart = (MyCart) cartButt.getTag();
switch (mycart) {
case ADD_TO_CART:
LOGD(TAG, "Add to cart");
saveProduct();
break;
case IN_CART:
LOGD(TAG, "In cart");
break;
case UPDATE_CART:
LOGD(TAG, "Update cart");
break;
}
break;
default:
break;
}
}
内容来源于网络,如有侵权,请联系作者删除!