當前位置: 首頁>>代碼示例>>Java>>正文


Java CompoundButton.setText方法代碼示例

本文整理匯總了Java中android.widget.CompoundButton.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java CompoundButton.setText方法的具體用法?Java CompoundButton.setText怎麽用?Java CompoundButton.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.CompoundButton的用法示例。


在下文中一共展示了CompoundButton.setText方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setConditionItem

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void setConditionItem(NewConditionItem item) {
    mRoot = item;
    mList.removeAllViews();
    LayoutInflater inflater = LayoutInflater.from(getContext());
    for (NewConditionItem subItem : mRoot.subItems) {
        CompoundButton cb = (CompoundButton) inflater.inflate(
                R.layout.item_condition_1, mList, false);
        cb.setTag(subItem);
        cb.setText(subItem.name);
        cb.setChecked(subItem.selected);
        cb.setOnClickListener(this);
        mList.addView(cb);

        if (subItem != mRoot.subItems.get(mRoot.subItems.size() - 1)) {
            inflater.inflate(R.layout.layout_condition_divider, mList);
        }
    }
}
 
開發者ID:Tamicer,項目名稱:FilterBar,代碼行數:20,代碼來源:SorterContainer.java

示例2: setConditionItem

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void setConditionItem(NewConditionItem item) {
    mRoot = item;
    mTvTitle.setText(item.name);
    mGrid.removeAllViews();
    for (NewConditionItem subItem : mRoot.subItems) {
        if (subItem.type != NewConditionItem.TYPE_LIST) {
            if (subItem.type == NewConditionItem.TYPE_DATA) {
                this.item = (DateSelectConditionItem) subItem;
                DataSelectContainer container2 = new DataSelectContainer(getContext());
                LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT
                );
                container2.setLayoutParams(lp2);
                container2.setTag(subItem);
                container2.setConditionItem(subItem);
                addFooterView(container2);
            }
            continue;

        }
        btn = (CompoundButton) LayoutInflater.from(getContext())
                .inflate(R.layout.item_condition_grid, mGrid, false);
        btn.setTag(subItem);
        btn.setText(subItem.name);
        btn.setChecked(subItem.selected);
        btn.setOnCheckedChangeListener(this);
        addToGrid(btn);
    }
}
 
開發者ID:Tamicer,項目名稱:FilterBar,代碼行數:32,代碼來源:GridContainer.java

示例3: onBindViewHolder

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(RegionContainer.VH holder, final int position) {
    final NewConditionItem item = mList.get(position);
    if (holder.getItemViewType() == TYPE_EDIT) {
        CompoundButton btnEdit = holder.tb;
                btnEdit.setText(item.name);
        btnEdit.setChecked(item.selected);
        btnEdit.setTag(item);
        btnEdit.setId(holder.getItemViewType());
        btnEdit.setOnClickListener(mOnClickListener);
        final View finalView = btnEdit;
        final NewConditionItem finalitem =item;
        btnEdit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnItemClickListener!= null) {
                   mOnItemClickListener.onEditClick(finalView, item.id);
                }
            }
        });

    } else {
        CompoundButton btn = holder.tb;
        btn.setText(item.name);
        btn.setChecked(item.selected);
        btn.setTag(item);
        btn.setId(holder.getItemViewType());
        btn.setOnClickListener(mOnClickListener);
    }

}
 
開發者ID:Tamicer,項目名稱:FilterBar,代碼行數:32,代碼來源:RegionContainer.java

示例4: makeButtonFromSearchEngine

import android.widget.CompoundButton; //導入方法依賴的package包/類
private CompoundButton makeButtonFromSearchEngine(SearchEngine engine, LayoutInflater layoutInflater, Resources res) {
    final CompoundButton buttonItem = (CompoundButton) layoutInflater.inflate(getItemResId(), null);
    buttonItem.setText(engine.getName());
    final int iconSize = (int) res.getDimension(R.dimen.preference_icon_drawable_size);
    final BitmapDrawable engineIcon = new BitmapDrawable(res, engine.getIcon());
    engineIcon.setBounds(0, 0, iconSize, iconSize);
    final Drawable[] drawables = buttonItem.getCompoundDrawables();
    buttonItem.setCompoundDrawables(engineIcon, null, drawables[2], null);
    return buttonItem;
}
 
開發者ID:mozilla-mobile,項目名稱:firefox-tv,代碼行數:11,代碼來源:SearchEngineListPreference.java

示例5: setToggleText

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void setToggleText(CompoundButton button, boolean checked) {
    button.setText(button.getContext().getString(checked ? R.string.whitelist_summary_discuss_on : R.string.whitelist_summary_discuss_off));
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:5,代碼來源:DiscussWhitelistActivity.java

示例6: setToggleText

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void setToggleText(CompoundButton button, boolean checked) {
    button.setText(button.getContext().getString(checked ? R.string.whitelist_summary_group_on : R.string.whitelist_summary_group_off));
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:5,代碼來源:GroupWhitelistActivity.java


注:本文中的android.widget.CompoundButton.setText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。