`

android shape渐近线效果

阅读更多

 


android画图-----shape的使用

在GradientDrawable1试图中终于把shape学会了,以前总是似懂非懂,
现在终于把里面的东西搞清楚了,同时也挺佩服谷歌的用心,故意设 置一些陷阱吧,不认真对待还真以为没有啥效果呢。

setContentView(R.layout.shape_drawable_1)
shape_drawable_1 代码如下:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

    <LinearLayout
    android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
   
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_1" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/line" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_2" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/line" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_3" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="20dip"
android:src="@drawable/line" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:src="@drawable/shape_4" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/line" />

<ImageView
android:layout_width="fill_parent"
android:layout_height="50dip"

android:src="@drawable/shape_5" />

</LinearLayout>
</ScrollView>
shape_5的代码:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF"
            android:angle="270"/>
    <padding android:left="50dp" android:top="20dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="8dp" />
   
</shape>
gradient  产生颜色渐变  android:angle 从哪个角度开始变 貌似只有90的整数倍可以
android:shape="rectangle" 默认的也是长方形

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
    <solid android:color="#ff4100ff"/>
    <stroke android:width="2dp" android:color="#ee31ff5e"
            android:dashWidth="3dp" android:dashGap="2dp" />
    <padding android:left="7dp" android:top="7dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="6dp" />
</shape>

#ff4100ff蓝色#ff4100ff绿色
     <solid android:color="#ff4100ff"/>实心的 填充里面
     <stroke 描边 采用那样的方式将外形轮廓线画出来

android:dashWidth="3dp" android:dashGap="2dp" 默认值为0

android:width="2dp" android:color="#FF00ff00"笔的粗细,
       android:dashWidth="5dp" android:dashGap="5dp" 实现- - -这样的效果,dashWidth指的是一条小横线的宽度
       dashGap 指的是 小横线与小横线的间距。 width="2dp" 不能太宽
分享到:
评论

相关推荐

    android shape的使用及渐变色、分割线、边框、半透明阴影

    Android Shape的使用及渐变色、分割线、边框、半透明阴影 Android Shape是一种在Android系统中使用的图形形状控件,可以用于创建各种形状的视图控件,例如矩形、椭圆、线条、圆环等。Shape控件可以使用xml文件来...

    Android中使用Shape自定义形状

    在Android开发中,Shape是XML布局文件中的一种元素,它允许开发者自定义各种图形,如矩形、椭圆、线和梯形等,用于创建丰富多彩的背景或按钮样式。本教程将深入探讨如何在Android中使用Shape来实现自定义形状。 1. ...

    android shape样式

    在Android开发中,Shape是XML资源文件中定义的一种图形元素,它可以用来创建各种形状,如矩形、椭圆、线和路径,同时支持自定义样式,包括圆角、虚线边框、部分圆角以及颜色的渐变效果。这篇内容将深入探讨Android ...

    android动态改变shape的颜色值

    通过以上步骤,我们可以根据用户交互或者程序逻辑动态地改变Android Shape的颜色值,从而实现更丰富的视觉效果和交互体验。这种方法在创建可定制的、动态变化的UI组件时非常有用,例如可切换主题的应用或根据数据...

    Android-android-shape-imageview-图片圆角三角五角圆形多角

    Shape Drawable允许开发者定义矩形、椭圆、线和路径等基本形状,并可以设置填充色、描边宽度和颜色等属性。 1. **圆角图片**:在XML drawable中,你可以通过`&lt;corners&gt;`标签设置ImageView的圆角半径,实现圆角效果...

    android 代码实现shape效果

    在Android开发中,Shape是用于绘制自定义图形的一种XML元素,通常被用来创建各种背景,如矩形、椭圆、线或边框等。在本主题中,我们将深入探讨如何通过代码实现`shape`效果,特别是使用`GradientDrawable`来创建渐变...

    android shape

    在Android开发中,Shape是XML布局文件中定义的一种图形元素,它可以用来创建各种形状,如矩形、椭圆、线和梯形等。Shape对象通常用于自定义视图的背景,或者在自定义布局中作为装饰元素。在这个"android shape"的...

    Android Shape实例

    在Android的`res/drawable`目录下创建一个XML文件,例如`shape.xml`,然后我们可以定义四种基本形状:`rectangle`(矩形)、`oval`(圆形)、`line`(线)和`ring`(环)。在这个实例中,我们将重点讨论`rectangle`...

    android Shape介绍

    3. **线(Line)**:绘制水平或垂直线,设置`android:shape="line"`,并用`&lt;stroke&gt;`定义线宽和颜色。 ```xml &lt;shape android:shape="line"&gt; &lt;stroke android:width="2dp" android:color="#0000FF"/&gt; &lt;size ...

    Android shape属性详解

    在Android开发中,Shape是XML绘图的一种基本元素,它允许开发者定义自定义的图形,如矩形、椭圆、线或梯形等,并应用于视图背景、按钮样式或者自定义视图等。Shape对象是Android图形绘制的核心部分,通过调整其属性...

    Android shape 属性深入用法

    在Android开发中,Shape是XML绘图资源的一种类型,它允许开发者定义自定义形状,用于绘制背景、按钮等UI元素。本篇文章将深入探讨Android Shape属性的使用方法,帮助开发者们更好地利用这一强大的功能。 首先,...

    Android-shape标签的使用

    - `android:shape="line"`:绘制一条线。`android:strokeWidth`定义线条宽度,`android:strokeColor`定义线条颜色。 4. **路径(path)**:使用贝塞尔曲线绘制复杂形状,这需要对图形路径有一定的了解。 接下来,...

    android shape实现阴影或模糊边效果

    1.实现阴影或模糊边效果方式: 2.通过shape来实现,具体是通过layer-list 多层叠放的方式实现的 &lt;?xml version=1.0 encoding=utf-8?&gt; &lt;layer-list xmlns:android=...

    Android_shape

    它属于Android的图形绘制层,主要用于定义各种形状,如矩形、圆形、椭圆、线等,并支持填充颜色、渐变、边框等效果。在本文中,我们将深入探讨`shape`在Android中的使用方法,以及如何通过`shape`来实现丰富的UI设计...

    Android shape 属性

    在Android开发中,Shape是XML绘图的一种基本元素,它允许开发者定义各种形状,并用于自定义View的背景、按钮样式、边框等视觉效果。这篇博客详细介绍了Android中Shape属性的使用,通过以下四个主要部分来阐述: 1. ...

    android XML shape优化界面

    在Android开发中,XML Shape是UI设计中一个重要的组成部分,它允许开发者通过XML定义图形,如矩形、椭圆、线以及自定义形状,来创建各种背景和装饰元素。本教程将深入探讨如何利用XML Shape优化Android应用的界面,...

    Android控件美化之Shape的使用

    ### Android控件美化之Shape的使用 在Android开发过程中,为了提升用户体验,界面美观是非常重要的...通过这些实例可以看出,`Shape`在Android控件的美化中扮演着重要的角色,能够帮助开发者快速实现丰富的视觉效果。

    Android ShapeDemo

    首先,`&lt;shape&gt;`标签是Android中用于创建几何形状的元素,它可以创建如矩形、椭圆、线和路径等形状。`&lt;shape&gt;`标签的基本结构如下: ```xml &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; ...

    Android之shape实现控件圆角、背景等

    Shape元素是Android图形绘制的基础,它主要有三种类型:`&lt;rectangle&gt;`(矩形)、`&lt;oval&gt;`(圆形)和`&lt;line&gt;`(线)。在XML资源文件中,通常会创建一个名为`shape.xml`的文件,放置在`res/drawable`目录下。基本结构...

Global site tag (gtag.js) - Google Analytics