在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" 不能太宽

更多相关文章

  1. android studio Could not find com.android.support.constraint
  2. Android(安卓)给 app默认权限(不弹窗申请权限)
  3. [RK3399][Android7.1.1] WifiAp:开机默认打开wifi热点
  4. Android常用控件
  5. Android(安卓)下拉刷新,非常强大的下拉刷新功能
  6. Android(安卓)屏幕设置
  7. Android(安卓)-- Android(安卓)JUint 与 Sqlite
  8. 重定向android log
  9. [RK3399][Android7.1] 调试笔记 --- 设置搜狗为开机默认输入法

随机推荐

  1. Android动画学习笔记-Android Animation
  2. android 开启Https单向认证
  3. textview设置文本每行的行间距
  4. Android如何设置TextView的行间距、行高
  5. Eclipse安装Android教程
  6. Launcher研究资料收集(3)--.LauncherAppl
  7. [转]Android 技术专题系列之九 -- 图形系统
  8. 如何使用Android Studio开发/调试Android
  9. Android 3D引擎汇总
  10. android中的格式化字符串