【问题标题】:Android How to hide the phone number programmaticallyAndroid 如何以编程方式隐藏电话号码
【发布时间】:2016-03-16 19:12:38
【问题描述】:

如何在通话过程中隐藏或显示我的电话号码而不进入设置?

【问题讨论】:

    标签: android hide phone-number phone-call


    【解决方案1】:

    您可以通过使用复选框来实现这一点:

     <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/cb_Show" />
     <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/text"
       />
    

    _

        CheckBox cbShow = (CheckBox) findViewById(R.id.cb_Show);
    TextView text=findViewById(R.id.text);
    
    text.setText("some text to hide");
    
            cbShow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (isChecked)
                        text.setVisibility(VIEW.INVISIBLE);
                    else
                        text.setVisibility(VIEW.VISIBLE);
                }
            });
    

    或者您可以使用切换按钮 example

    祝你好运

    【讨论】:

      猜你喜欢
      • 2013-06-22
      • 2012-03-19
      • 2011-08-22
      • 2011-03-11
      • 1970-01-01
      • 1970-01-01
      • 2013-01-24
      • 1970-01-01
      相关资源
      最近更新 更多