Android的背景与细线 [英] Android background with a thin line

查看:351
本文介绍了Android的背景与细线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个背景我的布局。

I would like to create a background for my layouts.

我现在使用的还是:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <solid android:color="@android:color/darker_gray" />
    </shape>
</item>

<item android:bottom="5dp">
    <shape android:shape="rectangle">
        <solid android:color="@android:color/black" />
   </shape>
</item>
</layer-list>

它的工作很好,直到该活动的背景是黑色的......但现在我会改变我的活动的背景。所以,不是我会用一个透明的背景,画上细细的(5DP)darker_gray线的按钮。

It works nice untill the activity background were black... But now I would change my activity background. So not I would use a transparent background and draw a thin(5dp) darker_gray line at button.

会有人帮助我通过项目和形状来创建它...像这个例子说明?

Would somebody help me to create it by using items and shapes ... like this example shows?

推荐答案

创建样式和Android清单文件应用它

create style and apply it in android manifest file

<style name="Transparent" parent="android:Theme.Light">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

    <color name="transparent">#00000000</color>

在清单:

android:theme="@style/Transparent"

这篇关于Android的背景与细线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆