Я хочу сделать дочерний линейный макет невидимым во время onCreate, а затем сделать его видимым при нажатии кнопки - PullRequest
0 голосов
/ 29 апреля 2020

XML Layout Here Это мой макет. Я хочу, чтобы все после кнопки было невидимым, пока кнопка не будет нажата.

/**
     * This activity toggles open the order_form layout AFTER "Order" Button is clicked.
     */
    Button properties = (Button) findViewById(R.id.order_button);

// and LinearLayout to toggle
    final LinearLayout propLayout = (LinearLayout) findViewById(R.id.order_form);

    properties.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            propLayout.setVisibility((propLayout.getVisibility() == View.VISIBLE)
                    ? View.INVISIBLE
                    : View.VISIBLE);
        }
    });

1 Ответ

0 голосов
/ 29 апреля 2020

атрибут размещения и видимости в xml примерно так

android: visibility = "invisible"

<LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:visibility="invisible">

   <-- edittext views here-->
   <EditText
      ......./>
</LinerLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...