使用到的布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffff"
android:gravity="center_horizontal">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="未使用效果"
android:layout_marginTop="30dp"
/>
<EditText
android:id="@+id/edit"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="未使用效果 未使用效果 未使用效果 未使用效果 未使用效果 未使用效果"
android:cursorVisible="true"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="使用效果"
android:layout_marginTop="10dp"
/>
<EditText
android:id="@+id/edit2"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果"
android:background="@drawable/shape"
android:cursorVisible="true"
/>
</LinearLayout>
使用到的shape文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="10dp"
/>
<gradient
android:startColor="#33CC00"
android:endColor="#666600"
android:angle="45"
/>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp"
/>
<stroke
android:width="3dp"
android:color="#FF3300"
/>
</shape>
在这里主要说一下shape文件中各项的功能
gradient主要设置背景颜色渐变。startColor为起始颜色值,endColor为结束颜色值,angle为渐变角度
padding主要设置组件里内容距离组件内边框的间距
stroke主要设置组件的边框。width为边框宽度,color为边框颜色
分享到:
相关推荐
主要介绍了Android使用shape使组件呈现出特殊效果的方法,结合实例形式分析了Android中shape文件相关属性、功能及使用方法,需要的朋友可以参考下
内容概要:了解基础Android组件的使用,以及shape和selector组件美化。 适合人群:初学Android开发的小萌新,可以利用这个小案例巩固Android基础控件的使用。 能学到什么:可以加深Android布局的使用,以及基础组件...
7.2 View动画的特殊使用场景 / 273 7.2.1 LayoutAnimation / 273 7.2.2 Activity的切换效果 / 275 7.3 属性动画 / 276 7.3.1 使用属性动画 / 276 7.3.2 理解插值器和估值器 / 280 7.3.3 属性动画的监听...
Android实现一个简易版本的购物车小案例。 (1)主要功能 ... 2、商品、购物车列表 (2)android 1、ViewPager2 + Fragment实现页面的切换。...2、SQLite数据库、基础组件的使用。 3、shape和selector修饰组件样式。
260 6.3 自定义Drawable / 262 第7章 Android动画深入分析 / 265 7.1 View动画 / 265 7.1.1 View动画的种类 / 265 7.1.2 自定义View动画 / 270 7.1.3 帧动画 / 272 7.2 View动画的特殊使用场景 / 273 7.2.1 ...
1.3 Android App组件架构 4 1.3.1 Android四大组件如何协同工作 5 1.3.2 应用运行上下文对象 5 1.4 Android系统源代码目录与系统目录 6 1.4.1 Android系统源代码目录 6 1.4.2 Android系统目录 8 1.4.3 Android...
给TextureView添加边框(专业名词为描边),有三种解决方案: 1.设置一个9 patch 的,右边框,中间是空的PNG。 2.自定义一个View,用Canvas画个边框。...shape xmlns:android=”http://schemas.android
Android-BackgroundLibrary.zip,一个通过标签直接生成形状的框架,无需再编写shape.xml(shape,shape.xml),安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建...
使用BackgroundLibrary库代替所有shape资源,请无视xml文件中app:bl_xxxx_xxxx="xxxx"错误 引入databinding,减少findViewById使用 珠穆朗玛FM 1.0 2019-10.22 用户登陆 珠穆朗玛FM 1.0 2019-10.09 友盟分享 珠穆
|--android root下禁用组件 |--android 判断网络状态 |--android 对话框样式 |--android 开机启动 |--android 挪动dialog的位置 |--android 控制对话框位置 |--android 根据uri获取路径 |--android 模拟器错误 |--...
组件 Components 企业 类库 类库说明 美团 Android CSDN Android segmentFault 博客文章 文章 说明 android基本知识 优秀的安卓库 AndroidStudio Android sqlite Android 架构介绍 Android 系统服务 Android ...
提供一组自定义形状的android imageview 组件,以及定义更多形状的框架。 实现基于着色器和位图蒙版的图像视图。 基于 的一种使用画布绘制方法和类, 基于掩码的一种使用在由 android 形状 XML 或资源位图定义的...
西伯利亚但丁初步打造一款属于Android快速开发的强大工具库项目包含库和样本,每个库中的工具类都在样本中作了测试,如遇到错误,烦请提交,万分感谢。使用中也可以参考样本。 implementation '...
背景按钮应该是我们的App里面最普遍的组件之一了,特别常用。通常我们写一个按钮的套路很简单也很固定。大概分为以下几个步骤:在xml布局里面按照设计稿的尺寸位置写一个Textview按照设计稿规定的颜色和圆角在...
Delphi开发Android和iOS应用程序的组件库,很不错! 1.TFMXScrollableList 2.TFMXRatingBar 3.TFMXCircleScoreIndicator 4.TFMXImageSlider 5.TFMXSimpleBBCodeText 6.TFMXGuesturePassword 7.TFMXCalendarControl 8...
组件,底层序列化/反序列化使用 protobuf 实现,性能高,稳定性强 Android 上一个优雅、高度自定义、性能高效的日历控件,完美支持周视图,支持标记、自定义颜色、农历等,任意控制月视图显示、任意日期拦截条件、...