0

我有一个意图:

    Intent myIntent = new Intent(this, MyActivity.class);

有一个与 MyActivity 相关的布局(带有按钮)。

如何删除或禁用 myIntent 中的按钮?

TIA

4

1 回答 1

0

我大多是这样做的

Intent intent = new Intent(this, MyActivity.class);
Bundle msges = new Bundle();
msges.putString("disableTheBtn", "yes");
intent.putExtras(msges);
startActivity(intent);

MyActivity 类里面

   public void onCreate(Bundle savedInstanceState) {
        ---------Do some thing , Button and GUI initialization-------
        try{ 
            String  disableTheBtn = getIntent().getExtras().getString("disableTheBtn"));
           if (disableTheBtn != null && !disableTheBtn.isEmpty(){
              yourBtn.setVisibilty(View.GONE);//hide that button
           } 
       }catch(Exception e){
           e.printStack();
       } 
   }
于 2012-12-08T06:26:16.293 回答