如何利用有形和无形的android系统中的一个按钮 [英] how to use visible and invisible for a button in android
问题描述
我想打一个按钮,看不见的,当我点击另一个按钮,然后隐形按钮将可见,然后执行的onClick()上可见的按钮操作。
什么的onClick()动作我可以在可见的按钮使用。下面我用这种显示方法:
donebutton =(按钮)findViewById(R.id.done);
donebutton.setOnClickListener(本);
donebutton.setVisibility(View.INVISIBLE);
@覆盖
公共无效的onClick(视图v){
// TODO自动生成方法存根
如果(v.equals(删除))
{
donebutton.setVisibility(View.VISIBLE);
}
如果(v.equals(donebutton))
{
意图I =新的意图(One.this,Second.class);
startActivity(ⅰ);
完();
donebutton.setVisibility(View.INVISIBLE);
}
}
在上述方法的无形和有形propertyes正在工作,但的onClick()行为是行不通的。所以请告诉我一个答案上述问题或告诉我,如果有任何其他的方法,可见和不可见的按钮的onclick该按钮的动作。
和我也用这个方法:
done.setClickable(真正的);
done.setOnClickListener(新OnClickListener(){
公共无效的onClick(视图v){
意图I =新的意图(One.this,Second.class);
startActivity(ⅰ);
完();
}
});
不使用 -
donebutton.setVisibility(4);
而不是使用静态常量这样的:
donebutton.setVisibility(View.VISIBLE);
究竟意味着
done.setVisibility(0);
是不是应该是
donebutton.setVisibility(View.GONE);
I want to make a button invisible, when i click another button then the invisible button will become visible and then perform onClick() actions on the visible button.
What onClick() actions I can use on the visible button. I used this method shown below:
donebutton = (Button) findViewById(R.id.done);
donebutton.setOnClickListener(this);
donebutton.setVisibility(View.INVISIBLE);
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v.equals(remove))
{
donebutton.setVisibility(View.VISIBLE);
}
if(v.equals(donebutton))
{
Intent i=new Intent(One.this,Second.class);
startActivity(i);
finish();
donebutton.setVisibility(View.INVISIBLE);
}
}
In the above method the invisible and visible propertyes are working but onClick() action is not working. so please tell me an answer for the above problem or tell me if there is any other method for visible and invisible on button and onclick action on that button.
and I also used this method:
done.setClickable(true);
done.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
Intent i=new Intent(One.this,Second.class);
startActivity(i);
finish();
}
});
DONT USE -
donebutton.setVisibility(4);
Instead use the static constants for this:
donebutton.setVisibility(View.VISIBLE);
What exactly means
done.setVisibility(0);
Isn't is supposed to be
donebutton.setVisibility(View.GONE);
这篇关于如何利用有形和无形的android系统中的一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!