如何将Widgets放在android中的actionBar之上?

时间:2014-01-25 18:02:16

标签: android

有人可以帮我知道如何在Android上的ActionBar上面放置一个Widget。我已经在stackoverflow上读了一些其他类似的查询,但它提到它不可能。以下是我试图创建的屏幕。可以让一个让我知道如何将蓝色布局部分放在动作栏上方?还是有其他方法可以实现这一点? 以下是我的xml文件

nearby.xml

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

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="100dp" >
    </LinearLayout>

    <android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </android.support.v4.view.ViewPager>

</LinearLayout>

但是我没有获得所需的布局。标题布局在操作栏下方可见。

所需的布局:

enter image description here

1 个答案:

答案 0 :(得分:1)

您看到的蓝色条是操作栏,使用自定义视图。查看setCustomView,了解如何自定义操作栏。

相关问题