在片段活动中编辑文本时,Admob广告不会消失

时间:2017-08-04 14:57:57

标签: android android-edittext visibility google-admob

当用户想要输入值时,Admob会阻止EditText。我介绍了这段代码,但它仍然没有用。

iAge = (EditText) v.findViewById(R.id.edAge);
iIncome= (EditText) v.findViewById(R.id.edIncome);

iAge.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void   onFocusChange(View view, boolean hasFocus) {
        if (hasFocus) {
            mAdView.setVisibility(View.GONE);
        } else {
            mAdView.setVisibility(View.VISIBLE);
        }
     }
});

iIncome.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View view, boolean hasFocus) {
        if (hasFocus) {
            mAdView.setVisibility(View.GONE);
        } else {
            mAdView.setVisibility(View.VISIBLE);
        }
    }
}); 

0 个答案:

没有答案