The method setBackgroundDrawable(Drawable) from the type View is deprecated求解

yicanday5 yicanday5 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
代码如下
package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;

public class MainActivity extends Activity {

private ImageButton Ibtn;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Ibtn = (ImageButton)findViewById(R.id.imageBtn);
Ibtn.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_DOWN){
Ibtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.press));
}
else if(event.getAction() == MotionEvent.ACTION_UP){
Ibtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.nopress));
}
return false;
}
});
}
}



其中setBackgroundDrawable函数中间打了一条横线,不能被用,为什么?
...全文

相关推荐

The method of type must override a superclass method解决方式, myeclipse, java, web

NULL 博文链接:https://thaipine.iteye.com/blog/2354220

weixin_38669628

A First Course in the Finite Element Method

这是关于有限元方法的电子书,高清,最新版本,经典著作,英文版

J-10

the probabilistic method(此版本不好,有重传的版本)

The probabilistic method is a nonconstructive method, primarily used in combinatorics and pioneered by Paul Erdős, for proving the existence of a prescribed kind of mathematical object. This method has now been applied to other areas of mathematics such as number theory, linear algebra, and real analysis. It works by showing that if one randomly chooses objects from a specified class, the probability that the result is of the prescribed kind is more than zero. Although the proof uses probability, the final conclusion is determined for certain, without any possible error. If every object in a collection of objects fails to have a certain property, then the probability that a random object chosen from the collection has that property is zero. Turning this around, if the probability that the random object has the property is greater than zero, then this proves the existence of at least one object in the collection that has the property. It doesn't matter if the probability is vanishingly small; any positive probability will do. Similarly, showing that the probability is (strictly) less than 1 can be used to prove the existence of an object that does not satisfy the prescribed properties. Another way to use the probabilistic method is by calculating the expected value of some random variable. If it can be shown that the random variable can take on a value less than the expected value, this proves that the random variable can also take on some value greater than the expected value. Common tools used in the probabilistic method include Markov's inequality, the Chernoff bound, and the Lovász local lemma.

littleBT

Gibbs Method.zip_Gibbs Method_The Method Method

The function is about Gibbs Method of determination the orbit by 3 position vectors

寒泊

New Method for Extracting the Quaternion from a Rotation Matrix

旋转矩阵转四元数

声时刻
评论 10
收藏 已收藏
分享
返回顶部
yicanday5
Android 80,490 成员 91,371 内容