- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
本质上,我正在尝试创建以下背景:
我用在背景的drawable中使用的传统渐变只支持开始颜色、中间颜色和结束颜色。
但是,正如您从模型中看到的那样,我试图在形状的顶部和底部仅创建一个轻微的覆盖/阴影,颜色为 #50000000
(黑色 50%不透明度)。
最佳答案
如果您在布局 View 中使用它,那么您可以简单地创建一个具有渐变背景的 View
并将其放置在布局的开头和结尾。
例如:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/parent">
<View
android:layout_width="fill_parent"
android:layout_height="5dp"
android:background="@drawable/gradient" />
<!-- Your other child views -->
<View
android:layout_width="fill_parent"
android:layout_height="5dp"
android:background="@drawable/gradient" />
</LinearLayout>
您的 gradient.xml
文件将包含以下内容:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#FFFFFF" android:endColor="#000000" android:angle="90"/>
</shape>
您可以为父布局指定蓝色背景色。
你基本上会得到这样的东西:
[编辑]
您可以创建两个可绘制对象 - gradient_top.xml
和 gradient_bottom.xml
以获得正确的角度
关于android - 具有纯色背景和顶部+底部内部阴影的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20442767/
我正在尝试更改iOS背景颜色,但是我认为透明度(alpha:1)似乎在起作用并改变了预期的颜色。 In **AppDelegate.m** rootView.backgroundColor = [
https://www.dropbox.com/s/4zkhtdv4yaqhpxy/Screenshot%20from%202015-01-28%2010%3A42%3A02%201.png?dl=0
照明不工作,对象显示为纯色。颜色本身随 Material 或照明参数而变化,但没有阴影或任何纯灰色。 部分代码如下: glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
ppt幻灯片生成时,系统默认是无色背景填充,幻灯片设计需要手动设置背景效果,可设置颜色填充或者图片背景填充。本文将对此介绍具体实现方法。 jar文件导入方法(参考): 步骤1:在java程序中可
我是一名优秀的程序员,十分优秀!