Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - how to set a foreground image that is centered on the screen?
    primarykey
    data
    text
    <p>I have been googling for a solution, and I only find solutions where <code>FrameLayout</code> or <code>RelativeLayout</code> is used, and I am using <code>LinearLayout</code>.</p> <p>What I am trying to do is display an image in the foreground saying "please wait" before some things load on the page. And I am trying to have that image be centered, and not shift the other page elements around...so for that I guess I need it in the foreground, right?</p> <p>How could I do this? Right now I have this:</p> <pre><code>&lt;ImageView android:id="@+id/please_wait" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/please_wait" android:foregroundGravity="center|fill_horizontal" /&gt; </code></pre> <p>But it is not centering the image and isn't putting it in the foreground.</p> <p>Here is the whole xml file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;include android:id="@+id/header" layout="@layout/header" android:layout_height="wrap_content" android:layout_width="fill_parent"/&gt; &lt;ImageView android:id="@+id/please_wait" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/please_wait" android:foregroundGravity="center|fill_horizontal" /&gt; &lt;TextView android:id="@+id/problem_loading_prompt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Getting the business(es) you are planning. They are stored in a database that is constantly backed up so you do not lose your work." /&gt; &lt;ListView android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/label" android:textSize="17sp"&gt; &lt;/ListView&gt; &lt;Button android:id="@+id/add_problem_ok" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/light_best_blue" android:text="Plan a New Business" android:layout_marginTop ="15dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks!</p>
    singulars
    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.
    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