Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Map v2 ImageView remains invisible even if set as visible
    primarykey
    data
    text
    <p>I need to show and hide an ImageView based on the user's behavior. I set the ImageView to be invisible in <code>onCreate()</code> and I try to make it visible again when the user selects an item in the OptionsMenu. The Strange thing is it doesn't show up at all and will only show up after the Activity resumes.</p> <p>Here is the XML code:</p> <pre><code>&lt;ImageView android:id="@+id/rectimage" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/rect" /&gt; </code></pre> <p>Where I hide imageview </p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); image = (ImageView) findViewById(R.id.rectimage); image.setVisibility(View.INVISIBLE); } </code></pre> <p>Where I try to make it visible again</p> <pre><code>@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_visible: image.setVisibility(View.VISIBLE); return true; } return false; } </code></pre> <p>Here is onStart and onResume , not do anything.</p> <pre><code>@Override protected void onStart() { super.onStart(); Log.w(TAG, "-- ON Start --"); } @Override public void onResume() { super.onResume(); Log.w(TAG, "-- ON Resume --"); } </code></pre> <p>And here is my drawable resource in XML</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt; &lt;solid android:color="@android:color/transparent"/&gt; &lt;corners android:radius="20px"/&gt; &lt;stroke android:width="2dip" android:color="#000000"/&gt; &lt;/shape&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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