本文整理汇总了Java中com.rey.material.widget.CompoundButton类的典型用法代码示例。如果您正苦于以下问题:Java CompoundButton类的具体用法?Java CompoundButton怎么用?Java CompoundButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompoundButton类属于com.rey.material.widget包,在下文中一共展示了CompoundButton类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCheckedChanged
import com.rey.material.widget.CompoundButton; //导入依赖的package包/类
@Override
public void onCheckedChanged(android.widget.CompoundButton v, boolean isChecked) {
int position = (Integer) v.getTag();
if (mSelected[position] != isChecked) {
mSelected[position] = isChecked;
if (mOnSelectionChangedListener != null)
mOnSelectionChangedListener.onSelectionChanged(position, mSelected[position]);
}
if (mMode == MODE_ITEMS && isChecked && mLastSelectedIndex != position) {
mSelected[mLastSelectedIndex] = false;
if (mOnSelectionChangedListener != null)
mOnSelectionChangedListener.onSelectionChanged(mLastSelectedIndex, false);
CompoundButton child = (CompoundButton) mListView.getChildAt(mLastSelectedIndex - mListView.getFirstVisiblePosition());
if (child != null)
child.setChecked(false);
mLastSelectedIndex = position;
}
}
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:19,代码来源:SimpleDialog.java示例2: getView
import com.rey.material.widget.CompoundButton; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CompoundButton v = (CompoundButton)convertView;
if(v == null) {
v = (mMode == MODE_MULTI_ITEMS) ? new CheckBox(parent.getContext(), null, 0, mCheckBoxStyle) : new RadioButton(parent.getContext(), null, 0, mRadioButtonStyle);
if(mItemHeight != ViewGroup.LayoutParams.WRAP_CONTENT)
v.setMinHeight(mItemHeight);
v.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
v.setTextDirection(((InternalListView)parent).isLayoutRtl() ? View.TEXT_DIRECTION_RTL : View.TEXT_DIRECTION_LTR);
v.setTextAppearance(v.getContext(), mItemTextAppearance);
ViewCompat.setPaddingRelative(v, mContentPadding, 0, 0, 0);
}
v.setTag(position);
v.setText(mItems[position]);
if(v instanceof CheckBox)
((CheckBox) v).setCheckedImmediately(mSelected[position]);
else
((RadioButton) v).setCheckedImmediately(mSelected[position]);
v.setOnCheckedChangeListener(this);
return v;
}
开发者ID:iamzhangdejian,项目名称:material-master,代码行数:26,代码来源:SimpleDialog.java示例3: onCheckedChanged
import com.rey.material.widget.CompoundButton; //导入依赖的package包/类
@Override
public void onCheckedChanged(android.widget.CompoundButton v, boolean isChecked) {
int position = (Integer)v.getTag();
if(mSelected[position] != isChecked) {
mSelected[position] = isChecked;
if(mOnSelectionChangedListener != null)
mOnSelectionChangedListener.onSelectionChanged(position, mSelected[position]);
}
if(mMode == MODE_ITEMS && isChecked && mLastSelectedIndex != position){
mSelected[mLastSelectedIndex] = false;
if(mOnSelectionChangedListener != null)
mOnSelectionChangedListener.onSelectionChanged(mLastSelectedIndex, false);
CompoundButton child = (CompoundButton) mListView.getChildAt(mLastSelectedIndex - mListView.getFirstVisiblePosition());
if(child != null)
child.setChecked(false);
mLastSelectedIndex = position;
}
}
开发者ID:iamzhangdejian,项目名称:material-master,代码行数:24,代码来源:SimpleDialog.java本文标签属性:
示例:示例英文
代码:代码编程
java:java自行车
CompoundButton:CompoundButton