【问题标题】:Drop shadow on Action Bar and Custom Camera View在操作栏和自定义相机视图上投影
【发布时间】:2012-03-31 21:42:37
【问题描述】:

目前,我有以下应用程序,它由一个 ActionBar 和一个自定义视图组成。看起来是这样的

我尝试在

上实现投影效果
  1. 操作栏(使用来自ActionBarSherlock 的库)
  2. 自定义相机视图

通过使用“9 补丁”技术,我可以在操作栏上投下阴影,但不能在自定义视图上投下阴影。

这是我正在使用的技术。我将windowContentOverlay 指定为“9 补丁”图像。根据文档,这是 windowContentOverlay 的用途。

这个 Drawable 覆盖在窗口内容的前景上 区域,通常在标题下方放置阴影。

我希望操作栏和自定义视图都归类为Drawable。通过在整个活动中使用以下样式

values/styles.xml

<resources>
    <style name="AppTheme" parent="@style/Theme.Sherlock.Light">
        <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
    </style>
</resources>

AndroidManifest.xml

<application android:theme="@styles/AppTheme">

actionbar_shadow.9.png

但是,我只能在操作栏上看到阴影,而不是我的自定义相机视图。

有关信息,这是我布局我唯一的 Activity 的方式。

layout/main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center" >

    <view xmlns:android="http://schemas.android.com/apk/res/android"
        class="org.yccheok.gui.CustomView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    />

</LinearLayout>

我想知道,为什么 windowContentOverlay 技术适用于操作栏,但不适用于我的自定义相机视图?

【问题讨论】:

    标签: android


    【解决方案1】:

    你可以使用这个来放置动作栏阴影:

    <item name="android:windowContentOverlay">@null</item>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多