更新Hello WorldのAndroidアクティビティが画面全体に表示されないのはなぜですか?
次のスタイルを追加し、自分のアプリケーションのためにそれを設定した後、私はそれが画面全体を描画得ている:
<resources>
<style name="app_theme" parent="android:Theme.NoTitleBar">
<item name="android:windowBackground">@color/green</item>
</style>
</resources>
私は私のアプリのことを実現してきた私の最初のAndroidアプリを開発している間私のダウンロードした他のサンプルプロジェクトは、スクリーン全体に広がることはありません。これをテストするために、基本アクティビティクラスを作成し、TextView
の背景を緑色に設定して、どれくらいのスパンがあるかを確認しました。もしこれが愚かな質問であれば私を許してください。しかし私はこれを初めて学んでいます。ここで
はスクリーンショットです:ここでは
は、完全なHomeActivity源である:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Hello World, StackOverflow"
android:background="#00FF00"
/>
</LinearLayout>
と、ここ:ここ
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);
}
}
は、レイアウトファイル(/res/layout/main.xml
)でありますeの別のアプリのスクリーンショットですmulatorウィンドウ全体にわたる、細かい作業:
編集
を私は今であることを私のXMLファイルを編集した:
<?xml version="1.0" encoding="utf-8"?>
<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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Hello World, StackOverflow"
/>
</LinearLayout>
その後洗浄して構築され、走ってました同じ正確なビュー。
編集2
要求されたように私は、何の変化も "縦" の向き行を削除しません。ここで
は私AndroidManifestです:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blah.blah.myCrap"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:label="@string/app_name" >
<activity android:name="HomeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
は<application>
まだ
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
間違ったサイズの下で私のマニフェストに以下を追加しました。
リニアレイアウトの背景色を設定します。これにより、切り捨てられているTextViewか、LinearLayoutかどうかを確認できます。 – Gophermofur
@GophermofurはTextViewからbgを削除しました.LinearLayoutに追加され、クリーンでビルドされました。同じ結果のビュー:-(。 –
manifest.xmlを投稿できますか? – Gophermofur