下面列出了怎么用android.widget.ToggleButton的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ctx = getApplicationContext();
this.registerReceiver(receiver, filter1);
this.registerReceiver(receiver, filter2);
tb1 = (ToggleButton)findViewById(R.id.toggleButton1);
audioM = (AudioManager) getApplicationContext().getSystemService(getApplicationContext().AUDIO_SERVICE);
bMgr = (BluetoothManager) getApplicationContext().getSystemService(getApplicationContext().BLUETOOTH_SERVICE);
ImageView img = (ImageView)findViewById(R.id.image1);
img.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse("https://github.com/sauravpradhan/"));
startActivity(intent);
}
});
btAdapter = BluetoothAdapter.getDefaultAdapter();
devices = btAdapter.getBondedDevices();
//Toast.makeText(getApplicationContext(),"No Of BT devices paired is:"+devices.size(),Toast.LENGTH_SHORT).show();
}
@Override
public void onClick(View v) {
String currentTab = mTabHost.getCurrentTabTag();
if (currentTab.equals("number")) {
if (mOnNumberEditListener != null) {
mOnNumberEditListener.onNumberEdit(0); // 0 as clear
}
dismiss();
} else {
for (ToggleButton b : mNoteNumberButtons.values()) {
b.setChecked(false);
mNoteSelectedNumbers.remove(b.getTag());
}
}
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
noScheduleContainer = view.findViewById(R.id.schedule_none_container);
noScheduleToggle = (ToggleButton) view.findViewById(R.id.schedule_none_container_checkbox);
noScheduleText = (Version1TextView) view.findViewById(R.id.scheduleNoneText);
noScheduleTextDescription = (Version1TextView) view.findViewById(R.id.scheduleNoneDescription);
dividerOne = view.findViewById(R.id.divider);
weeklyScheduleContainer = view.findViewById(R.id.schedule_weekly_container);
weeklyScheduleToggle = (ToggleButton) view.findViewById(R.id.schedule_weekly_container_checkbox);
weeklyScheduleText = (Version1TextView) view.findViewById(R.id.scheduleWeeklyText);
weeklyScheduleTextDescription = (Version1TextView) view.findViewById(R.id.scheduleWeeklyDescription);
dividerTwo = view.findViewById(R.id.divider2);
weeklyScheduleClickableRegion = (RelativeLayout) view.findViewById(R.id.weekly_schedule_clickable_region);
scheduleAbstractText = (Version1TextView) view.findViewById(R.id.scheduleAbstractText);
chevronImage = (ImageView) view.findViewById(R.id.chevron);
scheduleBottomText = (Version1TextView) view.findViewById(R.id.scene_schedule_bottom_text);
return view;
}
static boolean isTrackEvent(View view, boolean isFromUser) {
if (view instanceof CheckBox) {
if (!isFromUser) {
return false;
}
} else if (view instanceof RadioButton) {
if (!isFromUser) {
return false;
}
} else if (view instanceof ToggleButton) {
if (!isFromUser) {
return false;
}
} else if (view instanceof CompoundButton) {
if (!isFromUser) {
return false;
}
}
if (view instanceof RatingBar) {
if (!isFromUser) {
return false;
}
}
return true;
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
View onView = view.findViewById(R.id.on_cell);
View onPartialView = view.findViewById(R.id.on_partial_cell);
View partialView = view.findViewById(R.id.partial_cell);
View notParticipatingView = view.findViewById(R.id.not_participating_cell);
mOnCheck = (ToggleButton) view.findViewById(R.id.on_checkbox);
mOnPartialCheck = (ToggleButton) view.findViewById(R.id.on_partial_checkbox);
mPartialCheck = (ToggleButton) view.findViewById(R.id.partial_checkbox);
mNotParticipatingCheck = (ToggleButton) view.findViewById(R.id.not_participating_checkbox);
onView.setOnClickListener(this);
onPartialView.setOnClickListener(this);
partialView.setOnClickListener(this);
notParticipatingView.setOnClickListener(this);
return view;
}
public AlarmTopCardItemView(View view) {
super(view);
context = view.getContext();
mDashedCircleView = (DashedCircleView) view.findViewById(R.id.dashed_circle);
mCenterTopTextView = (Version1TextView) view.findViewById(R.id.center_top_text);
mCenterBottomTextView = (Version1TextView) view.findViewById(R.id.center_bottom_text);
mTopIconView = (ImageView) view.findViewById(R.id.top_icon);
mTopLineView = view.findViewById(R.id.top_line);
mLeftAlarmIcon = (ImageView) view.findViewById(R.id.left_alarm_icon);
mCenterAlarmText = (Version1TextView) view.findViewById(R.id.center_alarm_text);
mRightAlarmIcon = (ImageView) view.findViewById(R.id.right_alarm_icon);
placeName = (Version1TextView) view.findViewById(R.id.place_name);
placeAddress = (Version1TextView) view.findViewById(R.id.place_address);
cardView = (CardView) view.findViewById(R.id.cardView);
placeLayout = view.findViewById(R.id.place_layout);
topDivider = view.findViewById(R.id.topdivider);
careOnOffView = view.findViewById(R.id.care_on_off_toggle_container);
toggleButton = (ToggleButton) view.findViewById(R.id.care_on_off_toggle);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
chart = (BesselChart) findViewById(R.id.chart);
button = (ToggleButton) findViewById(R.id.toggle_btn);
button.setOnCheckedChangeListener(this);
// startActivity(new Intent(this, CubicActivity.class));
// chart.getStyle().setGridColor(Color.parseColor("#66CCCCCC"));
// chart.setData(getChartData(true));
// chart.setVelocityX(1.2f);
chart.setSmoothness(0.4f);
chart.setChartListener(this);
handler.postDelayed(new Runnable() {
@Override
public void run() {
// chart.setData(getChartData(true));
getSeriesList(true);
// chart.setDrawBesselPoint(true);
chart.setSmoothness(0.33f);
}
}, 1000);
}
public void addListenerOnButtonClick(){
//Getting the ToggleButton and Button instance from the layout xml file
toggleButton1=(ToggleButton)findViewById(R.id.toggleButton);
toggleButton2=(ToggleButton)findViewById(R.id.toggleButton2);
buttonSubmit=(Button)findViewById(R.id.button);
//Performing action on button click
buttonSubmit.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
StringBuilder result = new StringBuilder();
result.append("ToggleButton1 : ").
append(toggleButton1.getText());
result.append("\nToggleButton2 : ").
append(toggleButton2.getText());
//Displaying the message in toast
Toast.makeText(getApplicationContext(),
result.toString(), LENGTH_LONG).show();
}
});
}
@Override
public View style(View view, JSONObject attributes) throws Exception {
super.style(view, attributes);
ToggleButton toggleButton = (ToggleButton) view;
if(attributes.has("textOn")) {
toggleButton.setTextOn(attributes.getString("textOn"));
}
if(attributes.has("textOff")) {
toggleButton.setTextOn(attributes.getString("textOff"));
}
return toggleButton;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tb1 = (ToggleButton) findViewById(R.id.number_one);
tb2 = (ToggleButton) findViewById(R.id.number_two);
tb3 = (ToggleButton) findViewById(R.id.number_three);
tb4 = (ToggleButton) findViewById(R.id.number_four);
tb5 = (ToggleButton) findViewById(R.id.number_five);
tb1.setOnClickListener(this);
tb2.setOnClickListener(this);
tb3.setOnClickListener(this);
tb4.setOnClickListener(this);
tb5.setOnClickListener(this);
}
/**
* Updates selected numbers in note.
*
* @param numbers
*/
public void updateNote(Collection<Integer> numbers) {
mNoteSelectedNumbers = new HashSet<>();
if (numbers != null) {
mNoteSelectedNumbers.addAll(numbers);
}
ToggleButton toggleButton;
for (Integer number : mNoteNumberButtons.keySet()) {
toggleButton = mNoteNumberButtons.get(number);
toggleButton.setChecked(mNoteSelectedNumbers.contains(number));
if (toggleButton.isChecked()) {
ThemeUtils.applyIMButtonStateToView(toggleButton, ThemeUtils.IMButtonStyle.ACCENT);
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm);
settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
alarmTimePicker = (TimePicker) findViewById(R.id.alarmTimePicker);
alarmToggle = (ToggleButton) findViewById(R.id.alarmToggle);
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
pendingIntent = PendingIntent.getBroadcast(this, Alarm.ALARM_ID, new Intent(this, AlarmReceiver.class), PendingIntent.FLAG_CANCEL_CURRENT);
alarmTimePicker.setIs24HourView(settings.getBoolean("24-hour_format", true));
if (settings.getBoolean("alarm_toggle", false)) {
alarmToggle.setChecked(true);
} else {
alarmToggle.setChecked(false);
}
}
@Override
@SuppressLint("RestrictedApi")
public View onCreateView(String name, Context context, AttributeSet attrs) {
final Resources.Theme theme = context.getTheme();
switch (name) {
case "Button":
return new PandroidCompatButton(new ContextThemeWrapper(context, theme), attrs);
case "EditText":
return new PandroidCompatEditText(new ContextThemeWrapper(context, theme), attrs);
case "RadioButton":
return new PandroidCompatEditText(new ContextThemeWrapper(context, theme), attrs);
case "Switch":
return new PandroidCompatSwitch(new ContextThemeWrapper(context, theme), attrs);
case "TextView":
return new PandroidCompatTextView(new ContextThemeWrapper(context, theme), attrs);
case "ToggleButton":
return new ToggleButton(new ContextThemeWrapper(context, theme), attrs);
default:
return null;
}
}
@UiThreadTest
@Test public void simple() {
View tree = ViewTree.create(ToggleButton.class, 1);
View view1 = tree.findViewById(1);
Simple target = new Simple();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.clicks);
view1.performClick();
assertEquals(1, target.clicks);
unbinder.unbind();
view1.performClick();
assertEquals(1, target.clicks);
}
private void initView() {
mTimeZone = (View)findViewById(R.id.time_zone);
mWeekZone = (View)findViewById(R.id.week_zone);
mSenZone = (View)findViewById(R.id.sen_zone);
sDataText = (TextView) findViewById(R.id.show_start_time_txt);
eDataText = (TextView)findViewById(R.id.show_end_time_txt);
mSensit = (TextView) findViewById(R.id.sensit);
mOpenBtn1 = (com.zhongyun.viewer.widget.ToggleButton) findViewById(R.id.open_btn1);
mSunBtn1 = (ToggleButton) findViewById(R.id.sun_btn);
mMonBtn1 = (ToggleButton) findViewById(R.id.mon_btn);
mTueBtn1 = (ToggleButton) findViewById(R.id.tue_btn);
mWedBtn1 = (ToggleButton) findViewById(R.id.wed_btn);
mThuBtn1 = (ToggleButton) findViewById(R.id.thu_btn);
mFriBtn1 = (ToggleButton) findViewById(R.id.fri_btn);
mSatBtn1 = (ToggleButton) findViewById(R.id.sat_btn);
mSwitchText = (TextView)findViewById(R.id.text_switch);
}
private void storeAnswer(final String questionId, final String answerId) {
List<String> checkboxes = null;
//Get the selected checkboxes too:
final DecisionTree tree = getDecisionTree();
final DecisionTree.Question question = tree.getQuestion(questionId);
if ((question != null) && question.hasCheckboxes()) {
checkboxes = new ArrayList<>();
for (final DecisionTree.Checkbox checkbox : question.getCheckboxes()) {
final String checkboxId = checkbox.getId();
final ToggleButton button = mCheckboxButtons.get(checkboxId);
if ((button != null) && button.isChecked()) {
checkboxes.add(checkboxId);
}
}
}
//Remember the answer:
mClassificationInProgress.add(questionId, answerId, checkboxes);
}
private void updateSpeed(int newSpeed) {
// note: we assume at least button have proper speed-tag so this will
// check what it should
mSpeed = newSpeed;
ViewGroup bar = (ViewGroup) getView().findViewById(R.id.speed_control);
int count = bar.getChildCount();
for (int i = 0; i < count; i++) {
View child = bar.getChildAt(i);
try {
ToggleButton button = (ToggleButton) child;
int speed = Integer.parseInt((String) button.getTag());
button.setChecked(speed == newSpeed);
} catch (ClassCastException e) {
// not a button :)
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recorddisplay_activity);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);// 此方法必须重写
mGraspRadioButton = (RadioButton) findViewById(R.id.record_show_activity_grasp_radio_button);
mOriginRadioButton = (RadioButton) findViewById(R.id.record_show_activity_origin_radio_button);
mOriginRadioButton.setOnClickListener(this);
mGraspRadioButton.setOnClickListener(this);
mDisplaybtn = (ToggleButton) findViewById(R.id.displaybtn);
mDisplaybtn.setOnClickListener(this);
Intent recordIntent = getIntent();
int threadPoolSize = Runtime.getRuntime().availableProcessors() * 2 + 3;
mThreadPool = Executors.newFixedThreadPool(threadPoolSize);
if (recordIntent != null) {
mRecordItemId = recordIntent.getIntExtra(RecordActivity.RECORD_ID,
-1);
}
initMap();
}
/**
* 检测是否登录并执行关注/取消关注操作</br>
*
* @param topic
* @param toggleButton
* @param isFollow
*/
public void checkLoginAndExecuteOp(final Topic topic, final ToggleButton toggleButton,
final boolean isFollow) {
toggleButton.setClickable(false);
CommonUtils.checkLoginAndFireCallback(mContext, new SimpleFetchListener<LoginResponse>() {
@Override
public void onComplete(LoginResponse response) {
if (response.errCode != ErrorCode.NO_ERROR) {
toggleButton.setChecked(!toggleButton.isChecked());
toggleButton.setClickable(true);
return;
}
if (isFollow) {
followTopic(topic, toggleButton);
} else {
cancelFollowTopic(topic, toggleButton);
}
}
});
}
public void setEnable(Handler handler){
mHandler = handler;
toggleBt = (ToggleButton)view.findViewById(R.id.autoSwitch);
OnCheckedChangeListener listener = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
isAuto = arg1;
if(isAuto == true){
mLoopHandler.postDelayed(mRunnable,100);
}else{
byte[] wr = buildWrite(DEV_DCMOTOR, PORT_M1, slot, 0);
mHandler.obtainMessage(MSG_VALUECHANGED,wr).sendToTarget();
byte[] wr2 = buildWrite(DEV_DCMOTOR, PORT_M2, slot, 0);
mHandler.obtainMessage(MSG_VALUECHANGED,wr2).sendToTarget();
}
}
};
toggleBt.setOnCheckedChangeListener(listener);
}
private void initToggleButton(){
ToggleButton effectBtn = (ToggleButton) findViewById(R.id.toggle_effect);
ToggleButton callbackBtn = (ToggleButton) findViewById(R.id.toggle_callback);
final BrokenCallback callback = new MyCallBack();
CompoundButton.OnCheckedChangeListener listener = new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isOpen) {
switch (buttonView.getId()) {
case R.id.toggle_effect:
effectEnable = isOpen;
break;
case R.id.toggle_callback:
mBrokenView.setCallback(isOpen ? callback : null);
break;
}
}
};
effectBtn.setOnCheckedChangeListener(listener);
callbackBtn.setOnCheckedChangeListener(listener);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
AppSniffer154 app;
super.onCreate(savedInstanceState);
app = (AppSniffer154) getApplication();
app.checkForSnifferAttachedAction(getIntent());
setContentView(R.layout.packet_list);
findViewById(R.id.toggleCapture).setOnClickListener(this);
findViewById(R.id.toggleFilter).setOnClickListener(this);
checkButtonAutoscroll = (CheckBox) findViewById(R.id.checkBoxAutoScroll);
checkButtonAutoscroll.setChecked(true);
checkButtonAutoscroll
.setOnCheckedChangeListener(new AutoscrollOnCheckedChangeListener());
toggleFiltering = (ToggleButton) findViewById(R.id.toggleFilter);
// be notified when the current session changes
sessionContentObserver = new SessionContentObserver(new Handler());
// set up the packet list
listViewPacket = (ListView) findViewById(R.id.listViewPacket);
listViewPacket
.setOnItemClickListener(new PacketListViewOnItemClickListener());
setUpCursorLoader();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get a reference to a background container
final LinearLayout bg = (LinearLayout) findViewById(R.id.linearlayout);
// Get a reference to the ToggleButton
final ToggleButton button = (ToggleButton) findViewById(R.id.togglebutton);
// Set an OnClickListener on the ToggleButton
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Toggle the Background color between a light and dark color
if (button.isChecked()) {
bg.setBackgroundColor(0xFFF3F3F3);
} else {
bg.setBackgroundColor(0xFF000000);
}
}
});
}
protected void initAdapter() {
RecommendTopicAdapter adapter = new RecommendTopicAdapter(getActivity());
adapter.setFromFindPage(!mSaveButtonVisiable);
mAdapter = adapter;
adapter.setFollowListener(new FollowListener<Topic>() {
@Override
public void onFollowOrUnFollow(Topic topic, ToggleButton toggleButton,
boolean isFollow) {
if (isFollow) {
mPresenter.followTopic(topic, toggleButton);
} else {
mPresenter.cancelFollowTopic(topic, toggleButton);
}
}
});
mTopicListView.setAdapter(mAdapter);
}
public View getView(Context context, ViewGroup root) {
final BinarySetting self = this;
View settingView = LayoutInflater.from(context).inflate(getLayoutId(), root, false);
TextView title = (TextView) settingView.findViewById(R.id.setting_title);
TextView description = (TextView) settingView.findViewById(R.id.setting_description);
ToggleButton button = (ToggleButton) settingView.findViewById(R.id.toggle_button);
View divider = settingView.findViewById(R.id.divider);
divider.setBackgroundColor(isUseLightColorScheme() ? context.getResources().getColor(R.color.white_with_10) : context.getResources().getColor(R.color.black_with_10));
title.setTextColor(isUseLightColorScheme() ? Color.WHITE : Color.BLACK);
description.setTextColor(isUseLightColorScheme() ? context.getResources().getColor(R.color.white_with_35) : context.getResources().getColor(R.color.black_with_60));
title.setText(getTitle());
description.setText(getDescription());
button.setChecked(currentState);
// Hide the description if it's null
description.setVisibility(getDescription() == null ? View.GONE : View.VISIBLE);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(@NonNull View v) {
currentState = ((ToggleButton) v).isChecked();
fireSettingChangedAdapter(self, currentState);
}
});
return settingView;
}
public void updateToggleButton(@NonNull final ToggleButton button, final boolean checked) {
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
button.setChecked(checked);
}
});
}
catch (Exception ex) {
logger.error("Could not updateToggleButton, Ex: [{}], Value: [{}]", getSimpleName(ex), checked);
}
}
@Override
public void doStatusSection() {
View energyView = statusView.findViewById(R.id.light_switch_status_energy);
toggleButton = (ToggleButton) statusView.findViewById(R.id.light_switch_toggle_button);
TextView powerUsageTopText = (TextView) energyView.findViewById(R.id.top_status_text);
powerUsageBottomText = (TextView) energyView.findViewById(R.id.bottom_status_text);
powerUsageElement = (LinearLayout) energyView.findViewById(R.id.light_switch_status_energy);
if(hideEnergy) {
powerUsageElement.setVisibility(View.INVISIBLE);
} else {
powerUsageElement.setVisibility(View.VISIBLE);
}
powerUsageTopText.setText(getString(R.string.energy_usage_text));
updatePowerUsage(powerUsageBottomText);
toggleButton.setChecked(shouldGlow());
updateImageGlow();
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleButton.setEnabled(false);
updateCheckedState(toggleButton.isChecked());
}
});
}
private void displayAccounts (final AccountLoaderResult result) {
for (final ServiceRef svc : result.getAccounts()) {
final View existingView = this.llSubAccounts.findViewWithTag(svc);
if (existingView == null) {
final View view = View.inflate(this.llSubAccounts.getContext(), R.layout.subaccountitem, null);
view.setTag(svc);
configureAccountBtn((ToggleButton) view.findViewById(R.id.btnEnableAccount), svc);
this.llSubAccounts.addView(view);
}
}
}
@Override
public void createViews(Context context, ViewGroup layout) {
ToggleButton tb = new ToggleButton(context);
tb.setText("Vibrate off");
tb.setTextOff("Vibrate Off");
tb.setTextOn("Vibrate On");
PixateFreestyle.setStyleClass(tb, "myToggleButton");
layout.addView(tb, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(tb);
}
private void addTag(String tagName, int id, ViewGroup column, int color) {
ToggleButton tagButton = new ToggleButton(this);
if(color != -1) {
LinearLayout colorBox = new LinearLayout(this);
// Convert the dps to pixels, based on density scale
final int tagPaddingPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
1, getResources().getDisplayMetrics());
final int tagPaddingPxBottom = (int) TypedValue.applyDimension(TypedValue
.COMPLEX_UNIT_DIP,
3, getResources().getDisplayMetrics());
//use a GradientDrawable with only one color set, to make it a solid color
colorBox.setBackgroundResource(R.drawable.tag_round_corner);
GradientDrawable gradientDrawable = (GradientDrawable) colorBox.getBackground();
gradientDrawable.setColor(color);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams
.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(tagPaddingPx,tagPaddingPx,tagPaddingPx,tagPaddingPxBottom);
colorBox.setLayoutParams(params);
colorBox.addView(tagButton);
column.addView(colorBox);
} else {
column.addView(tagButton);
}
tagButton.setTextOff(tagName);
tagButton.setTextOn(tagName);
boolean isChecked = checkedTags.contains(id);
tagButton.setChecked(isChecked);
if(isChecked) {
tagButton.setTextColor(selectedColor);
}
tagButton.setOnCheckedChangeListener(new TagStateListener(id, checkedTags));
tagButton.setMinHeight(0);
tagButton.setMinimumHeight(0);
tagButton.setTextSize(Dimension.SP, 12);
tagButton.setEnabled(record == null || record.getUploadId().isEmpty());
tagButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
tagButton.invalidate();
}