layer-list

What is wrong with my layer-list drawable?

女生的网名这么多〃 提交于 2019-12-10 22:16:25
问题 I wanted to set a custom drawable to be the android:src of FloatingActionButton in this layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:sscce="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" sscce

Change bottom property of item of layer-list Drawable programmatically

时间秒杀一切 提交于 2019-12-10 14:46:51
问题 I am creating a LayerDrawable that creates bottom stroke but i dont know how to give bottom margin of a layer(Drawablw). <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="2dp"> .. </item> </layer-list> I want to set bottom margin like above programmatically. So far i have done this: Drawable[] list = new Drawable[2]; GradientDrawable strokeDrawable = new GradientDrawable( GradientDrawable.Orientation.TOP_BOTTOM, new int[] { strokeColor[0],

Layer-List with items having top/bottom properties

北战南征 提交于 2019-12-10 11:41:29
问题 I am trying to customize the view of the SeekBar as follows: <SeekBar android:id="@id/seek_bar_player" android:layout_width="match_parent" android:layout_height="6pt" android:paddingLeft="0pt" android:paddingRight="0pt" android:paddingStart="0pt" android:paddingEnd="0pt" android:layout_marginBottom="-2pt" android:layout_above="@id/player_container" android:progressDrawable="@drawable/seekbar_progress" android:thumb="@drawable/seekbar_thumb" android:padding="0pt" /> The content of seekbar

Layer-List with items having top/bottom properties

佐手、 提交于 2019-12-08 16:22:43
I am trying to customize the view of the SeekBar as follows: <SeekBar android:id="@id/seek_bar_player" android:layout_width="match_parent" android:layout_height="6pt" android:paddingLeft="0pt" android:paddingRight="0pt" android:paddingStart="0pt" android:paddingEnd="0pt" android:layout_marginBottom="-2pt" android:layout_above="@id/player_container" android:progressDrawable="@drawable/seekbar_progress" android:thumb="@drawable/seekbar_thumb" android:padding="0pt" /> The content of seekbar_progress.xml is, <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android

Change Margin of a Layout using XML in Layer-List

独自空忆成欢 提交于 2019-12-07 04:49:52
问题 I tried several options but I can't find the best way to do this: I want to change the margin of a Linear Layout when button is clicked using XML. Here's my code for the selected button: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="-1dp"> <shape android:shape="rectangle" > <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <solid android:color="#424346" /> <stroke android:width="1dp"

android shape xml rotated drawable change color programmatically

亡梦爱人 提交于 2019-12-06 14:08:05
This is a xml for triangle shape: <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/shape_id"> <rotate android:fromDegrees="45" android:toDegrees="45" android:pivotX="-40%" android:pivotY="87%" > <shape android:shape="rectangle" > <stroke android:width="10dp"/> </shape> </rotate> </item> </layer-list> And this is a background of a textview <TextView android:id="@+id/headlineSelect_TXT2" android:layout_width="50dp" android:layout_height="50dp" android:layout_weight="1" android:background="@drawable/category_triangle_shape1" android:visibility=

How to make shadow in layer-list?

谁说我不能喝 提交于 2019-12-06 05:45:38
The problem is as follows: I need to make in app widget some actionbar like this: For this I use layer-list with shape. <?xml version="1.0" encoding="utf-8"?> <!-- Bottom 2dp Shadow --> <item> <shape android:shape="rectangle"> <solid android:color="#027668"/> <corners android:radius="12dp"/> </shape> </item> <!-- White Top color --> <item android:bottom="4dp"> <shape android:shape="rectangle"> <solid android:color="#20a18b" /> <corners android:radius="7dp" /> </shape> </item> And I get some view: but, I cant do some around shadow like on first image in this post. How to do that? Here you go:

通过layer-list多图层叠加效果实现圆角功能

五迷三道 提交于 2019-12-05 22:13:09
在android的开发过程中,我们可能会做圆角的效果出来,如下图所示: 四个角都是圆角的效果。如果让UI设计人员直接出图,可能会更简单一些。但是我们使用android中layer-list多图层叠加效果同样可以实现。 我们把它拆分为三个部分,第一个部分是最顶端的那一行(我这里称为顶部),第二部分是中间部分(中间部分不需要圆角效果),第三部分是底部。 顶部的实现: 顶部是一个有灰色边框但无下边框,带圆角,白色背景的长方体 。实现效果如下: <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item > <shape> <solid android:color="#FFFFFF" /> <corners android:topLeftRadius="10dp" android:topRightRadius="10dp" android:bottomRightRadius="0.1dp" android:bottomLeftRadius="0.1dp" /> <stroke android:width="1dp" android:color="#ffa8abad" /> </shape> </item> <item

Change Margin of a Layout using XML in Layer-List

为君一笑 提交于 2019-12-05 09:22:44
I tried several options but I can't find the best way to do this: I want to change the margin of a Linear Layout when button is clicked using XML. Here's my code for the selected button: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="-1dp"> <shape android:shape="rectangle" > <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" /> <solid android:color="#424346" /> <stroke android:width="1dp" android:color="#2d2e2f" /> </shape> </item> </layer-list> Now I want to add the changing of margin which

How do I add padding to a bitmap and a color in a layer-list

北城以北 提交于 2019-12-03 10:48:12
问题 I need to create a drawable with a layer-list such that the background layer is an image and the foreground is a transparent color. I am able to do that. Where I am not succeeding is adding some padding/margin so that at them bottom a piece of the images shows without the colored layer on top of it. Here is my xml. Thanks for helping. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/img1" /> <