我可以设置类似"提示"在Android的一个看法?

我可以设置类似"提示"在Android的一个看法?

问题描述:

我可以设置一些消息,看起来像一个工具提示为一个TextView或按钮?

Can I set some message to appear like a "tooltip" for a TextView or Button?

有徘徊在触摸屏的概念,但你可以设置一个LongClickListener为您的浏览,并有吐司似乎经过了漫长的preSS。事情是这样的:

There's no concept of "hovering" in a touch screen, but you could set a LongClickListener for your View, and have a Toast appear after a long press. Something like this:

Toast viewToast = Toast.makeText(this, "My View Tooltip", Toast.LENGTH_SHORT);

View myView = (View)findViewById(R.id.my_view);

myView.setOnLongClickListener(new OnLongClickListener() {
    @Override
    public void onLongClick(View v) {
        viewToast.show();
    }
});

编辑:看了您的评论后,你应该只使用提示属性在你的EditText XML布局:

After reading your comment, you should just use the hint attribute in your EditText XML layout:

<EditText
    android:hint="My tip here" />