Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I just recently had a similar problem when using the android:visibility="gone"</p> <pre><code>&lt;RelativeLayout android:id="@+id/relativeLayoutMessage" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/linearLayoutMenu" android:layout_above="@+id/layoutButtons"&gt; &lt;ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:contentDescription="@string/image_attachment" android:src="@drawable/icon" android:scaleType="fitCenter" android:layout_height="fill_parent" android:layout_alignParentTop="true" /&gt; &lt;TextView android:id="@+id/textViewTitle" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:textSize="20dip" android:layout_alignParentTop="true"/&gt; &lt;TextView android:id="@+id/textViewText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" android:gravity="center" android:layout_below="@+id/textViewTitle"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>With the ImageView above the TextViews, the application would crash at the following line.</p> <p>Java file:</p> <pre><code> setContentView(R.layout.display_image); imageView = (ImageView) findViewById(R.id.imageView); </code></pre> <p>If I moved the ImageView below the TextViews, the application would run but the TextViews were covered by the ImageView.</p> <p>Once I removed the android:visibility="gone", the findViewById resolved correctly. All I had to do was to set the visibility in the code afterwards.</p> <pre><code>textViewText.setVisibility(TextView.GONE); </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