Reputation: 369
I would like to create a background for my layouts.
What I used still now is:
<?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>
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?
Upvotes: 0
Views: 3839
Reputation: 369
I found a good solution:
<item
android:bottom="0dp"
android:left="-6dp"
android:right="-6dp"
android:top="-6dp">
<shape android:shape="rectangle" >
<stroke
android:width="5dp"
android:color="@android:color/darker_gray" />
<solid android:color="#00FFFFFF" />
</shape>
</item>
Upvotes: 2
Reputation: 6027
Try this this will display a thin black line at button of a LinearLayout having White background.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<padding android:bottom="1dp"/>
<solid android:color="#ff333333"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#ffffffff"/>
</shape>
</item>
</layer-list>
Upvotes: 0
Reputation: 18978
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>
in manifest:
android:theme="@style/Transparent"
Upvotes: 1