Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isn't my Hello World Android Activity spanning the entire screen?
    primarykey
    data
    text
    <p><b>Update</b></p> <p>After adding the following style and setting it for my application, I have gotten it draw the whole screen:</p> <pre><code>&lt;resources&gt; &lt;style name="app_theme" parent="android:Theme.NoTitleBar"&gt; &lt;item name="android:windowBackground"&gt;@color/green&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>While developing my first Android app I've realized that my apps' views never span the entire screen whereas other sample projects I have downloaded do. To test this I have created a basic activity class and set the background of a <code>TextView</code> to green to see how much it is spanning. Forgive me if this is a stupid question but I am new to this.</p> <p>Here is the screenshot:</p> <p><img src="https://i.stack.imgur.com/JG2ak.png" alt="enter image description here"></p> <p>Here is the complete HomeActivity Source:</p> <pre><code>public class HomeActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre> <p>Here is the layout file (<code>/res/layout/main.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:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Hello World, StackOverflow" android:background="#00FF00" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>and here is a screenshot of another app in the emulator working fine, spanning the whole window:</p> <p><img src="https://i.stack.imgur.com/rR5jZ.png" alt="enter image description here"></p> <p><b>Edit</b></p> <p>I edited my XML file to now be:</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" android:background="#00FF00" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Hello World, StackOverflow" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Then cleaned and built, ran and got the same exact view.</p> <p><b>Edit 2</b></p> <p>I removed the "vertical" orientation line as requested, no change.</p> <p>Here is my AndroidManifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.blah.blah.myCrap" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; &lt;application android:label="@string/app_name" &gt; &lt;activity android:name="HomeActivity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p></p> <p>Added the following to my manifest under <code>&lt;application&gt;</code></p> <pre><code>&lt;supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" /&gt; </code></pre> <p>Still the wrong size.</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.
 

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