Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的菜单,但没有菜单按钮_Android_Google Maps - Fatal编程技术网

android中的菜单,但没有菜单按钮

android中的菜单,但没有菜单按钮,android,google-maps,Android,Google Maps,我想在我的android应用程序中创建一个菜单,但我不希望通过按下菜单按钮显示菜单,我只希望它在没有菜单按钮的情况下显示 例如: 这是android上的谷歌地图应用程序 我想在底部显示这样的菜单,而应用程序运行时没有菜单按钮。 我希望有人能得到我想要的东西:) 非常感谢。如果您只需要菜单,请执行以下操作: public class Test extends ListActivity { String classes[] = { "first item", "second item", "t

我想在我的android应用程序中创建一个菜单,但我不希望通过按下菜单按钮显示菜单,我只希望它在没有菜单按钮的情况下显示

例如: 这是android上的谷歌地图应用程序 我想在底部显示这样的菜单,而应用程序运行时没有菜单按钮。 我希望有人能得到我想要的东西:)


非常感谢。

如果您只需要菜单,请执行以下操作:

 public class Test extends ListActivity {
 String classes[] = { "first item", "second item", "third item", "fourth 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);
    setListAdapter(new ArrayAdapter<String>(Test.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 planet = classes[position];
    try {
        Class ourClass = Class.forName("com.test.test." + planet);
        Intent ourIntent = new Intent(Test.this, ourClass);
        startActivity(ourIntent);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    }
   }
公共类测试扩展了ListActivity{
字符串类[]={“第一项”、“第二项”、“第三项”、“第四项”};
@凌驾
创建时受保护的void(Bundle savedInstanceState){
//TODO自动生成的方法存根
super.onCreate(savedInstanceState);
requestWindowFeature(窗口。功能\u无\u标题);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_全屏,
WindowManager.LayoutParams.FLAG(全屏);
setListAdapter(新阵列适配器)(Test.this,
android.R.layout.simple_list_item_1,class));
}
@凌驾
受保护的void onListItemClick(列表视图l、视图v、整数位置、长id){
//TODO自动生成的方法存根
super.onListItemClick(左、右、位置、id);
字符串行星=类别[位置];
试一试{
Class-ourClass=Class.forName(“com.test.test.+planet”);
意向ourIntent=新意向(Test.this,ourClass);
星触觉(ourIntent);
}catch(classnotfounde异常){
e、 printStackTrace();
}
}
}
此代码不会像上图那样为您创建菜单,但它将为您提供标准菜单,您可以根据需要自定义它。
希望这有帮助

你可以这么做。 例如:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true" >

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <ImageButton
                android:id="@+id/imageButton1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/icon" />
        </LinearLayout>
    </RelativeLayout>
</RelativeLayout>

您看到的是一个放置在操作栏上的微调器


Android的网站上有一个关于微调器的教程,你可以在

上找到,如果你再次阅读我的帖子,我指的是底部的那一个,而不是顶部的微调器菜单,顺便说一句,非常感谢你的帮助,我也需要这个链接:)。哦。这只是ICS设备上的溢出菜单项。(你指的是三个垂直的圆点,对吗?)如果是这样的话,只需像平常一样填充菜单并使用操作栏。溢出按钮将出现在缺少菜单按钮的设备上,它会显示你的普通菜单项。如果你的意思是页面中间的菜单,希望你自己显示,而不是一个单独的列表,你会想浏览开发者手册的对话框部分:我知道菜单中的溢出:…但我指的是菜单本身,没有按菜单按钮。。谢谢你提供更多信息。关于对话框:)