caw*_*caw 15 navigation user-interface android titlebar
我希望在我的应用程序顶部有一个菜单栏 - 就像Facebook,Google +或Twitter一样:
这是Twitter应用程序的屏幕截图,显示了这个栏:它显示在每个活动中,左侧是公司徽标(可点击),右侧是1-3个菜单项(可点击图片).

它也可以在GDCatalog应用程序中看到:

因此,该操作栏有一些要求:
实施此类操作栏的最佳做法是什么?
GreenDroid就是这样(使用合并):
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<merge
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
style="?attr/gdActionBarItemStyle"
android:id="@+id/gd_action_bar_item"
android:layout_height="fill_parent"
android:scaleType="center" />
<ImageView
android:layout_width="?attr/gdActionBarDividerWidth"
android:layout_height="fill_parent"
android:background="?attr/gdActionBarDividerDrawable" />
<TextView
style="?attr/gdActionBarTitleStyle"
android:id="@+id/gd_action_bar_title"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="left|center_vertical"
android:singleLine="true"
android:textColor="?attr/gdActionBarTitleColor"
android:textSize="16sp"
android:textStyle="bold"
android:paddingRight="10dp"
android:paddingLeft="10dp" />
</merge>
Run Code Online (Sandbox Code Playgroud)
这是一个好的解决方案吗?它也可以在旧平台上运行吗?这里还缺少哪些编码部分?
我知道我们可以在这里找到关于这些动作栏的几个问题.但是,我无法找到实现跨(几乎)所有API级别的菜单栏的最佳和最简单的方法.是谷歌的解决方案也许是最好的?
非常感谢提前!
ble*_*enm 14
您可能想要签出ActionBarSherlock.源代码可在此处获得.它将让您了解它如何与片段一起使用.它将为您提供有关如何继续的一些想法.
有一个Android兼容性库,谷歌创建它使用他们为较低版本(如1.5及以上版本)为蜂窝创建的一些新API.它可以在android sdk文件夹中找到,如E:\ Program Files\Android\android-sdk-windows\android-compatibility\v4\android-support-v4.jar.如果你没有这个罐子,你需要使用avd管理器下载它.
| 归档时间: |
|
| 查看次数: |
12626 次 |
| 最近记录: |