Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>XML code</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:padding="5dp" android:orientation="vertical" &gt; &lt;EditText android:id="@+id/edtInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="number" android:visibility="gone" /&gt; &lt;Button android:id="@+id/btnInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:text="Input"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Activity code</p> <pre><code>public class MyInputActivity extends Activity implements OnClickListener { private EditText edtInput; private Button btnInput; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my); edtInput = (EditText) findViewById(R.id.edtInput); btnInput = (Button) findViewById(R.id.btnInput); btnInput.setOnClickListener(this); } @Override public void onClick(View arg0) { if(edtInput.getVisibility() == View.VISIBLE){ edtInput.setVisibility(View.GONE); // write your more code here on gone }else{ edtInput.setVisibility(View.VISIBLE); // write your more code here on visible } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload