本文整理了Java中android.widget.Switch.setId()
方法的一些代码示例,展示了Switch.setId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Switch.setId()
方法的具体详情如下:
包路径:android.widget.Switch
类名称:Switch
方法名:setId
暂无
代码示例来源:origin: lygttpod/SuperTextView
mSwitchParams.addRule(RelativeLayout.CENTER_VERTICAL, TRUE);
mSwitchParams.setMargins(0, 0, rightSwitchMarginRight, 0);
mSwitch.setId(R.id.sRightSwitchId);
mSwitch.setLayoutParams(mSwitchParams);
代码示例来源:origin: googlesamples/android-AppRestrictionEnforcer
private void updateApprovals(Context context, String[] approvals,
String[] selectedApprovals) {
mCurrentRestrictions.putStringArray(RESTRICTION_KEY_APPROVALS, selectedApprovals);
mLayoutApprovals.removeAllViews();
for (String approval : approvals) {
Switch sw = new Switch(context);
sw.setText(approval);
sw.setTag(approval);
sw.setChecked(Arrays.asList(selectedApprovals).contains(approval));
sw.setOnCheckedChangeListener(this);
sw.setId(R.id.approval);
mLayoutApprovals.addView(sw);
}
}
内容来源于网络,如有侵权,请联系作者删除!