2012-10-02 190 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