2012-10-02 244 views
2

我有ListActivity由許多行組成,每個事物都運行良好,當第一次運行App時顯示黑色屏幕(1秒)顯示listactivity屏幕之前,在這個黑色屏幕的左上角顯示應用程序的標題名稱,我們把它在創造新的Eclipse項目的begining如下形象:Listactivity黑色屏幕標題

enter image description here

請,如果您有任何意見如何刪除:這似乎

黑屏(1秒)顯示listactivity scre之前en與它的標題。

我知道這個冠軍也將是應用的正是我要

取出黑色屏幕,其標題中出現的應用程序圖標在設備 名稱,

所以當午餐在App它直接顯示,如下listactivity屏幕:

enter image description here

listactivity代碼:

public class Menu extends ListActivity { 

    String classes[] = { "First Item", "Second Item", "Third Item", "Fourth 
     Item", "Fifth Item"}; 

    @Override 
protected void onCreate(Bundle savedInstanceState) { 
// TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 

requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
    WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    ListView lv = getListView(); 
    lv.setCacheColorHint(0); 
    lv.setBackgroundResource(R.drawable.fall); 
setListAdapter(new ArrayAdapter<String>(Menu.this, 
    android.R.layout.simple_list_item_1, classes)); 

        } 
    @Override 
    protected void onListItemClick(ListView l, View v, int position, long id) { 
    // TODO Auto-generated method stub 

    super.onListItemClick(l, v, position, id); 
    String cheese = classes[position]; 

    try { 
    Class ourClass = Class.forName("com.test.demo.MyItem"); 
    Intent ourIntent = new Intent(Menu.this, ourClass); 
    ourIntent.putExtra("cheese", cheese); 
    startActivity(ourIntent); 
     } catch (ClassNotFoundException e) { 
    e.printStackTrace(); }}} 

在此先感謝。

UPDATE:

應用全屏幕菜單活動清單將解決這個問題,因爲這:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> 

,但我已經在清單指定自定義主題,以菜單的活動,因爲這:

android:theme="@style/Theme_menu" 

那麼我該如何將上述兩個主題一起分配到菜單活動中。

+0

聲明爲全屏在清單 – njzk2

+1

@ njzk2你的意思只是寫這篇文章的清單:機器人:主題=「@安卓風格/ Theme.NoTitleBar.Fullscreen」> – androidqq6

+0

@ njzk2我已經指定自定義主題到清單中的菜單活動,如下所示:android:theme =「@ style/Theme_menu」,我怎樣才能全屏應用ñ清單,請幫助。 – androidqq6

回答

1

如果我正確理解你的問題,看起來你只需要讓你的Theme_menu來源於Android的Theme.NoTitleBar.Fullscreen。要做到這一點,通過添加parent屬性修改你的風格XML:

<style 
    name="Theme_menu" 
    parent="@android:style/Theme.NoTitleBar.Fullscreen"> 

    <!-- your style modifications for Theme_menu here --> 

</style> 

隨着上述變化,你會最想就不需要在你活動的onCreate()方法,這些行(因爲它是由設定的主題) :

requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
+0

upvote +1&accept,thans很多我的朋友。 – androidqq6