How to add a button dynamically in Android?

后端 未结 17 1348
礼貌的吻别
礼貌的吻别 2020-11-22 13:17

How to add a button dynamically in Android?

17条回答
  •  生来不讨喜
    2020-11-22 13:54

    Actually I add to the xml layout file anything that could be used! Then from the source code of the specific Activity I get the object by its id and I "play" with the visibility method.

    Here is an example:

    ((Spinner)findViewById(R.id.email_spinner)).setVisibility(View.GONE);

提交回复
热议问题