当前位置: 首页 > news >正文

丽水企业网站建设公司好用的h5网站模板

丽水企业网站建设公司,好用的h5网站模板,汕头seo收费,给wordpress添加表单Android 自定义组件 Android 提供了非常精致的和非常强大的组件化模型#xff0c;能够更加方便的构建UI,这些UI组件都是基于基本的layout类:View 和 ViewGroup。 部分能够用的widgets包括#xff1a;Button#xff0c;TextView,EditText,ListView,CheckBox#xff0c;Radio… Android 自定义组件 Android 提供了非常精致的和非常强大的组件化模型能够更加方便的构建UI,这些UI组件都是基于基本的layout类:View 和 ViewGroup。 部分能够用的widgets包括ButtonTextView,EditText,ListView,CheckBoxRadioButton,Gallery,Spinner,和一些比较特殊用途的widgetsAutoCompleteTextView, ImageSwitcher, and TextSwitcher. 布局组件有LinearLayout, FrameLayout, RelativeLayout,absoluteLayout,TabelLayout 如果预定义的widgets和布局组件都不符合您的需求那就需要创建属于自己的view如果只是需要对已有的widget和layout进行小部分的调整那就可以通过重写部分一些方法来完成开发。 下面就举个例子讲解如何创建自定义的xml属性以及如果使用。 1. 首先创建一个新的android application. 2. 创建属性在res/values/ 下创建一个attr.xml 文件定义好需要的attributes ?xml version1.0 encodingutf-8? resourcesdeclare-styleable namecustomattr nametext formatstring /attr namesize formatinteger/attr namecolor formatreference|color//declare-styleable /resources 3. 创建自定义的View 创建一个View CustomView 继承自View(根据具体的情况如果需求和已经存在的widget或者layout相差不大就继承重写一些方法) package com.hualu.androidview;import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.view.View;public class CustomView extends View {private Paint p null;private String text null;public CustomView(Context context) {super(context);initCustomView() ;}public CustomView(Context context, AttributeSet attrs){super(context, attrs ) ;initCustomView() ;TypedArray a context.obtainStyledAttributes(attrs,R.styleable.custom) ;int indexCount a.getIndexCount() ;for(int i 0 ; i indexCount ; i ){int index a.getIndex(i) ;switch (index) {case R.styleable.custom_text:text a.getString(index) ;break;case R.styleable.custom_size:p.setTextSize(a.getInt(index, 0)); break;case R.styleable.custom_color:p.setColor(a.getColor(index, 0xFF000000)) ;break;}}a.recycle() ;}void initCustomView(){p new Paint();p.setAntiAlias(true);} ;Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);canvas.drawText(text, 10, 10, p) ;}}4. 在layout的文件使用自定义的view RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:customhttp://schemas.android.com/apk/res/com.hualu.androidviewxmlns:toolshttp://schemas.android.com/toolsandroid:layout_widthmatch_parentandroid:layout_heightmatch_parenttools:context.MainActivity TextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerHorizontaltrueandroid:layout_centerVerticaltrueandroid:textstring/hello_world /com.hualu.androidview.CustomViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentcustom:textcustom viewcustom:color#00FF00custom:size18//RelativeLayout 5. 运行应用 结果 转载于:https://www.cnblogs.com/java20130722/archive/2013/03/31/3207276.html
http://wiki.neutronadmin.com/news/135441/

相关文章:

  • 原创网站模版什么是网络设计图
  • 手机网站首页怎么做网站开发的招标参数
  • 国内 响应式网站网站在百度的标头不对
  • 铁路项目建设 网站wordpress 导航栏登录
  • 没有备案的网站百度不收录商业网页设计培训
  • 找培训机构的网站百度公司官方网站
  • 成品网站w灬源码伊甸3m8uui设计培训学费多少
  • 南京哪个网站建设比较好东莞关键词优化效果
  • php网站开发外文深圳专业做网站的公司哪家好
  • 网站备份还原杭州市建设工程质量安全监督总站网站
  • 做毕业设计个人网站任务书汕尾北京网站建设
  • 友情链接交换工具seo公司哪家便宜
  • 株洲外贸网站建设WordPress文章过滤
  • 长沙网站托管seo优化公司企业网站wordpress
  • 怎么才能找到想做网站建设的客源农业信息网站建设
  • 网站建设结构设计seo金融术语
  • 乔拓云智能建站平台朋友圈推广
  • 建站资源js 网站简体繁体
  • 红花岗区建设局网站常用的设计软件有哪些
  • 电商网站建设推荐阿里巴巴网站域名
  • 管理系统网站免费下载百度app最新版本
  • 网站空间哪个好品牌建设总结
  • 老鹰主机 建wordpress重庆百度整站优化
  • 做旅游网站的任务成都网站建设网
  • amp 网站开发网站做支付系统
  • 什么叫个人网站软件网站查询域名ip查询
  • 青海网站开发建设wordpress检查元素
  • wordpress 图片站模板互联网设计师leader
  • 千牛商家版网站建设网页小游戏网址
  • 有哪些是外国人做的网站北京专业网站建设公司