当前位置: 首页>>代码示例>>Java>>正文


Java RadioButton.getId方法代码示例

本文整理汇总了Java中android.widget.RadioButton.getId方法的典型用法代码示例。如果您正苦于以下问题:Java RadioButton.getId方法的具体用法?Java RadioButton.getId怎么用?Java RadioButton.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RadioButton的用法示例。


在下文中一共展示了RadioButton.getId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: riskButtonListener

import android.widget.RadioButton; //导入方法依赖的package包/类
public void riskButtonListener(View v) {
    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radio_group);
    RadioButton radioButton = (RadioButton) findViewById(R.id.radio_yes);
    TextView message = (TextView) findViewById(R.id.risk_validation);
    if (radioGroup.getCheckedRadioButtonId() != -1) {
        message.setVisibility(View.INVISIBLE);
        mRisk = radioGroup.getCheckedRadioButtonId()
                == radioButton.getId();
        nextPage();
    } else {
        message.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:14,代码来源:CreateIssueActivity.java

示例2: setCheckedId

import android.widget.RadioButton; //导入方法依赖的package包/类
/** 查找复合控件并设置id */
private void setCheckedId(ViewGroup vg) {
    int len = vg.getChildCount();
    for (int i = 0; i < len; i++) {
        if (vg.getChildAt(i) instanceof RadioButton) {// 如果找到了,就设置check状态
            final RadioButton button = (RadioButton) vg.getChildAt(i);
            int id = button.getId();
            // generates an id if it's missing
            if (id == View.NO_ID) {
                id = button.hashCode();
                button.setId(id);
            }
            button.setOnCheckedChangeListener(mChildOnCheckedChangeListener);
        } else if (vg.getChildAt(i) instanceof ViewGroup) {// 迭代查找并设置
            ViewGroup childVg = (ViewGroup) vg.getChildAt(i);
            setCheckedId(childVg);
        }
    }
}
 
开发者ID:ZouJianFeng-Marco,项目名称:Navigation-bar,代码行数:20,代码来源:FlowRadioGroup.java

示例3: onChildViewAdded

import android.widget.RadioButton; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void onChildViewAdded(View parent, View child) {
    if (parent == MultiRadioGroup.this ) {
        List<RadioButton> btns = getAllRadioButton(child);
        if(btns != null && btns.size() > 0){
            for(RadioButton btn : btns){
                int id = btn.getId();
                // generates an id if it's missing
                if (id == View.NO_ID && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                    id = View.generateViewId();
                    btn.setId(id);
                }
                btn.setOnCheckedChangeListener(
                        mChildOnCheckedChangeListener);
            }
        }
    }
    if (mOnHierarchyChangeListener != null) {
        mOnHierarchyChangeListener.onChildViewAdded(parent, child);
    }
}
 
开发者ID:JackWHLiu,项目名称:jackknife,代码行数:24,代码来源:MultiRadioGroup.java

示例4: onRadioButtonClicked

import android.widget.RadioButton; //导入方法依赖的package包/类
@OnClick({ R.id.rd_home, R.id.rd_features,R.id.rd_me }) public void onRadioButtonClicked(RadioButton radioButton) {
    boolean checked = radioButton.isChecked();
    switch (radioButton.getId()) {
        case R.id.rd_home:
            if (checked) {
                fUtil.show(mFragments.get(0));break;
            }
        case R.id.rd_features:
            if (checked) {
                fUtil.show(mFragments.get(1));break;
            }
        case R.id.rd_me:
            if (checked) {
                fUtil.show(mFragments.get(2));break;
            }
    }
}
 
开发者ID:WeGdufe,项目名称:MovingGdufe-Android,代码行数:18,代码来源:MainActivity.java

示例5: onSourceAlignmentChanged

import android.widget.RadioButton; //导入方法依赖的package包/类
@OnCheckedChanged({ R.id.source_align_start, R.id.source_align_center, R.id.source_align_end })
void onSourceAlignmentChanged(RadioButton button, boolean isChecked) {
    if (isChecked) {
        int alignment = Gravity.NO_GRAVITY;
        switch (button.getId()) {
            case R.id.source_align_start:
                alignment = Gravity.START;
                break;
            case R.id.source_align_center:
                alignment = Gravity.CENTER_HORIZONTAL;
                break;
            case R.id.source_align_end:
                alignment = Gravity.END;
                break;
        }
        onUpdateListener.updateSourceTextAlignment(alignment);
    }
}
 
开发者ID:shazam,项目名称:reflow-animator,代码行数:19,代码来源:AdvancedOptionsDialogFragment.java

示例6: onTargetAlignmentChanged

import android.widget.RadioButton; //导入方法依赖的package包/类
@OnCheckedChanged({ R.id.target_align_start, R.id.target_align_center, R.id.target_align_end })
void onTargetAlignmentChanged(RadioButton button, boolean isChecked) {
    if (isChecked) {
        int alignment = Gravity.NO_GRAVITY;
        switch (button.getId()) {
            case R.id.target_align_start:
                alignment = Gravity.START;
                break;
            case R.id.target_align_center:
                alignment = Gravity.CENTER_HORIZONTAL;
                break;
            case R.id.target_align_end:
                alignment = Gravity.END;
                break;
        }
        onUpdateListener.updateTargetTextAlignment(alignment);
    }
}
 
开发者ID:shazam,项目名称:reflow-animator,代码行数:19,代码来源:AdvancedOptionsDialogFragment.java

示例7: onRadioButtonClicked

import android.widget.RadioButton; //导入方法依赖的package包/类
/**
 * onClick handler for radio buttons.
 */
public void onRadioButtonClicked(View view) {
    int newSize;

    RadioButton rb = (RadioButton) view;
    if (!rb.isChecked()) {
        Log.d(TAG, "Got click on non-checked radio button");
        return;
    }

    switch (rb.getId()) {
        case R.id.surfaceSizeTiny_radio:
            newSize = SURFACE_SIZE_TINY;
            break;
        case R.id.surfaceSizeSmall_radio:
            newSize = SURFACE_SIZE_SMALL;
            break;
        case R.id.surfaceSizeMedium_radio:
            newSize = SURFACE_SIZE_MEDIUM;
            break;
        case R.id.surfaceSizeFull_radio:
            newSize = SURFACE_SIZE_FULL;
            break;
        default:
            throw new RuntimeException("Click from unknown id " + rb.getId());
    }
    mSelectedSize = newSize;

    int[] wh = mWindowWidthHeight[newSize];

    // Update the Surface size.  This causes a "surface changed" event, but does not
    // destroy and re-create the Surface.
    SurfaceView sv = (SurfaceView) findViewById(R.id.hardwareScaler_surfaceView);
    SurfaceHolder sh = sv.getHolder();
    Log.d(TAG, "setting size to " + wh[0] + "x" + wh[1]);
    sh.setFixedSize(wh[0], wh[1]);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:40,代码来源:HardwareScalerActivity.java

示例8: onRadioButtonClicked

import android.widget.RadioButton; //导入方法依赖的package包/类
/**
 * onClick handler for radio buttons.
 */
public void onRadioButtonClicked(View view) {
    RadioButton rb = (RadioButton) view;
    if (!rb.isChecked()) {
        Log.d(TAG, "Got click on non-checked radio button");
        return;
    }

    switch (rb.getId()) {
        case R.id.recDrawTwice_radio:
            mSelectedRecordMethod = RECMETHOD_DRAW_TWICE;
            break;
        case R.id.recFbo_radio:
            mSelectedRecordMethod = RECMETHOD_FBO;
            break;
        case R.id.recFramebuffer_radio:
            mSelectedRecordMethod = RECMETHOD_BLIT_FRAMEBUFFER;
            break;
        default:
            throw new RuntimeException("Click from unknown id " + rb.getId());
    }

    Log.d(TAG, "Selected rec mode " + mSelectedRecordMethod);
    RenderHandler rh = mRenderThread.getHandler();
    if (rh != null) {
        rh.setRecordMethod(mSelectedRecordMethod);
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:31,代码来源:RecordFBOActivity.java

示例9: onClick

import android.widget.RadioButton; //导入方法依赖的package包/类
public void onClick(View v) {
    RadioButton rb = (RadioButton) v;
    if (rb.getId() == R.id.rbclassic) {
    		prefs.notationstyle = "classic";
    		prefs.SavePreferences();
    }
    
    else if (rb.getId() == R.id.rbletters) {
    		prefs.notationstyle = "letters";
    		prefs.SavePreferences();
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:13,代码来源:Settings.java


注:本文中的android.widget.RadioButton.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。