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

微信有网站开发吗国家高新技术企业管理办法

微信有网站开发吗,国家高新技术企业管理办法,怎样做婚庆网站,站长之家seo查询官方网站看到很多项目会有实现自己的标题栏的做法#xff0c;通常的界面是左边按钮或文字#xff0c;加上中间的标题和右边的按钮或文字组成的。比较好的一种做法是使用include标签#xff0c;复用同一个xml文件来实现布局的复用。但是这种方法是通过代码的方式来设置标题#xff0…看到很多项目会有实现自己的标题栏的做法通常的界面是左边按钮或文字加上中间的标题和右边的按钮或文字组成的。比较好的一种做法是使用include标签复用同一个xml文件来实现布局的复用。但是这种方法是通过代码的方式来设置标题左右按钮等其他的属性会导致布局属性和Activity代码耦合性比较高。因此我们要通过自定义View继承ViewGroup子类来实现这样的布局降低布局文件和Activity代码耦合性。首先我们需要写出布局文件layout_custom_titlebar.xml。android:idid/title_bar_leftandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_alignParentLefttrueandroid:layout_centerVerticaltrueandroid:layout_marginLeft5dpandroid:backgroundnullandroid:minHeight45dpandroid:minWidth45dpandroid:textSize14sp /android:idid/title_bar_titleandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttrueandroid:singleLinetrueandroid:textSize17sp /android:idid/title_bar_rightandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_alignParentRighttrueandroid:layout_centerVerticaltrueandroid:layout_marginRight7dpandroid:backgroundnullandroid:minHeight45dpandroid:minWidth45dpandroid:textSize14sp /2.定义自定义属性3.自定义一个View继承ViewGroup子类这里我们继承RelativeLayout。public class CustomTitleBar extends RelativeLayout {private Button titleBarLeftBtn;private Button titleBarRightBtn;private TextView titleBarTitle;public CustomTitleBar(Context context) {super(context);}public CustomTitleBar(Context context, AttributeSet attrs) {super(context, attrs);LayoutInflater.from(context).inflate(R.layout.layout_custom_titlebar,this,true);titleBarLeftBtn (Button) findViewById(R.id.title_bar_left);titleBarRightBtn (Button) findViewById(R.id.title_bar_right);titleBarTitle (TextView) findViewById(R.id.title_bar_title);TypedArray typedArraycontext.obtainStyledAttributes(attrs,R.styleable.CustomTitleBar);if(typedArray!null){//titleBar背景色int titleBarBackGroundtypedArray.getResourceId(R.styleable.CustomTitleBar_title_background_color, Color.BLUE);setBackgroundColor(titleBarBackGround);//获取是否要显示左边按钮boolean leftButtonVisible typedArray.getBoolean(R.styleable.CustomTitleBar_left_button_visible, true);if (leftButtonVisible) {titleBarLeftBtn.setVisibility(View.VISIBLE);} else {titleBarLeftBtn.setVisibility(View.INVISIBLE);}//设置左边按钮的文字String leftButtonText typedArray.getString(R.styleable.CustomTitleBar_left_button_text);if (!TextUtils.isEmpty(leftButtonText)) {titleBarLeftBtn.setText(leftButtonText);//设置左边按钮文字颜色int leftButtonTextColor typedArray.getColor(R.styleable.CustomTitleBar_left_button_text_color, Color.WHITE);titleBarLeftBtn.setTextColor(leftButtonTextColor);} else {//设置左边图片icon 这里是二选一 要么只能是文字 要么只能是图片int leftButtonDrawable typedArray.getResourceId(R.styleable.CustomTitleBar_left_button_drawable, R.mipmap.titlebar_back_icon);if (leftButtonDrawable ! -1) {titleBarLeftBtn.setBackgroundResource(leftButtonDrawable);}}//先获取标题是否要显示图片iconint titleTextDrawable typedArray.getResourceId(R.styleable.CustomTitleBar_title_text_drawable, -1);if (titleTextDrawable ! -1) {titleBarTitle.setBackgroundResource(titleTextDrawable);} else {//如果不是图片标题 则获取文字标题String titleText typedArray.getString(R.styleable.CustomTitleBar_title_text);if (!TextUtils.isEmpty(titleText)) {titleBarTitle.setText(titleText);}//获取标题显示颜色int titleTextColor typedArray.getColor(R.styleable.CustomTitleBar_title_text_color, Color.WHITE);titleBarTitle.setTextColor(titleTextColor);}//获取是否要显示右边按钮boolean rightButtonVisible typedArray.getBoolean(R.styleable.CustomTitleBar_right_button_visible, true);if (rightButtonVisible) {titleBarRightBtn.setVisibility(View.VISIBLE);} else {titleBarRightBtn.setVisibility(View.INVISIBLE);}//设置右边按钮的文字String rightButtonText typedArray.getString(R.styleable.CustomTitleBar_right_button_text);if (!TextUtils.isEmpty(rightButtonText)) {titleBarRightBtn.setText(rightButtonText);//设置右边按钮文字颜色int rightButtonTextColor typedArray.getColor(R.styleable.CustomTitleBar_right_button_text_color, Color.BLUE);titleBarRightBtn.setTextColor(rightButtonTextColor);} else {//设置右边图片icon 这里是二选一 要么只能是文字 要么只能是图片int rightButtonDrawable typedArray.getResourceId(R.styleable.CustomTitleBar_right_button_drawable, -1);if (rightButtonDrawable ! -1) {titleBarRightBtn.setBackgroundResource(rightButtonDrawable);}}typedArray.recycle();}}public void setTitleClickListener(OnClickListener onClickListener) {if (onClickListener ! null) {titleBarLeftBtn.setOnClickListener(onClickListener);titleBarRightBtn.setOnClickListener(onClickListener);}}public Button getTitleBarLeftBtn() {return titleBarLeftBtn;}public Button getTitleBarRightBtn() {return titleBarRightBtn;}public TextView getTitleBarTitle() {return titleBarTitle;}}4.正确地使用它xmlns:apphttp://schemas.android.com/apk/res-autoandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalandroid:idid/ctb_viewandroid:layout_widthmatch_parentandroid:layout_height45dpapp:right_button_drawablemipmap/sureapp:title_textstring/app_name /android:layout_widthmatch_parentandroid:layout_height45dpandroid:layout_marginTop4dpapp:title_background_colorcolor/colorPrimaryapp:title_textstring/app_nameapp:title_text_colorcolor/colorAccentapp:left_button_text左边app:right_button_text右边/android:layout_widthmatch_parentandroid:layout_height45dpandroid:layout_marginTop4dpapp:title_text_drawablemipmap/ic_launcherapp:title_background_colorcolor/colorAccentapp:left_button_text左边app:right_button_text右边/以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持。
http://www.zqtcl.cn/news/480160/

相关文章:

  • 广州做网站的价格三个关键词介绍自己
  • 基于工作过程的商务网站建设:网页制作扬州网站建设公元国际
  • wordpress著名网站微信公众号怎么做网站链接
  • 长沙网站建设大概多少钱深圳做网站网络营销公司
  • 融资平台排行榜企业网站seo运营
  • 英文手表网站南昌装修网站建设
  • 网站建设要懂哪些技术甘肃园区网络搭建
  • go做的网站微信跳转链接生成器免费
  • 网站开发中怎么设置快捷键怎样打开用sql做的网站
  • 做餐饮企业网站的费用短视频素材免费下载网站
  • 美食优秀设计网站制作网页网站
  • 提供网站建设教学视频做淘宝美工需要知道的网站
  • 百度云可以做网站吗织梦网站下载
  • 有没有一起做游戏棋牌网站的用wordpress做商城
  • 有没有如何做网站的书常州网站推广公司哪家好
  • 金融直播间网站开发专业定制网页设计
  • 装饰公司网站开发c 网站开发实例教程
  • 专业层析成像代做网站网站建设收获
  • saas云建站平台源码附近那里有做网站的
  • 网站开发接口成都学校网站建设
  • 商城网站策划火星建站和八亿建站
  • 如何使用模板做网站php精品网站建设
  • 建设一个网站的具体流程职业培训机构需要什么资质
  • 网站怎么做弹幕播放器自助免费网站制作
  • 网站咨询弹窗是怎么做的网站建设的目标客户
  • 搞好姓氏源流网站建设Wordpress 商城主题过于臃肿
  • 如何网站客户案例上海网站备案查询
  • 沈阳大熊网站建设制作北京门户网站制作公司
  • 如何制作自己的网站免费最好的建站平台
  • 自己网站做电子签章有效么网站的规划与建设案例分析