2012-02-13 15 views
0

高密度の携帯電話と画面がすべてわかりましたが、私の問題はなぜ私の背景色がページ全体を満たしていないのですか?私のタブレットでは、それは背景色のちょうど小さな箱であり、残りは単なるブロック背景です。助けてください。Android:fill_parentとwrap_contentですべてのデバイスの全画面が表示されない

高品質の携帯電話では、3つの異なる画像を作成して別々のフォルダに入れなければならないということですか、1つの画像を作成してフォルダに入れておけば他のすべてのケア?本当に私は正確に私の画像の品質/解像度を制御し、アプリケーションがどちらを選択するか、またはアプリケーションが自動的に適切な解像度とサイズに画像を変更する場合はわかりません。

活動ファイル:

package u.nav.it; 

import android.app.Activity; 
import android.os.Bundle; 
import android.view.Window; 

public class UNavitActivity extends Activity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
     setContentView(R.layout.main); 
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); 
    } 
} 

custom_title.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/relativeLayout1" 
    android:layout_width="fill_parent" 
    android:background="#62CFD2" 
    android:layout_height="fill_parent"> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="20dp" 
     android:src="@drawable/selectiontitle"/> 

</RelativeLayout> 

custom_style.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 

    <style name="CustomWindowTitleBackground"> 
     <item name="android:background">#323331</item> 
    </style> 

    <style name="CustomTheme" parent="android:Theme"> 
     <item name="android:windowTitleSize">50dp</item> 
     <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item> 
    </style> 

</resources> 

main.xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 

</LinearLayout> 

マニフェスト:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="u.nav.it" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:label="@string/app_name" 
      android:name=".UNavitActivity" android:theme="@style/CustomTheme" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 
+0

本当にあなたの質問に対する答えはありませんが、「カスタムタイトル」の代わりにアクションバーを実装するべきではありませんか?ほとんどのデバイスをサポートするには、[ActionBarSherlock](http://actionbarsherlock.com/)を使用できます。 – dmon

+0

タイトルバーはちょうどテキスト(実際にはテキストのイメージ)になりますが、私はボタンやそのようなものを持つことを計画していません。その色をそのまま残しておけば、テキストが変わるかもしれません。アクションバーは本当に必要でしょうか? – LiverpoolFTW

+0

あなたのマニフェストで宣言された最小/目標sdkとは何ですか? – Phil

答えて

0

を拡大を支援するためにdraw9patchの画像を使用してみてください、私は単純にアプリがサポートされ、私のマニフェストの画面サイズで追加する必要がありました。私はどうやってばかげているの?

0

が充填されていないスペース

+0

私のヘッダーイメージのみを展開しますか?それはアプリ全体の背景に影響しますか?私のmain.xmlにandroid:background = "color"を設定すると、スクリーン全体がその色にならないのはなぜですか? – LiverpoolFTW

関連する問題