中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

怎么做培訓(xùn)班網(wǎng)站石家莊關(guān)鍵詞優(yōu)化軟件

怎么做培訓(xùn)班網(wǎng)站,石家莊關(guān)鍵詞優(yōu)化軟件,中國(guó)食品加工網(wǎng),wordpress the7不顯示分類(lèi)頁(yè)安卓開(kāi)發(fā)自定義時(shí)間日期顯示組件 問(wèn)題背景 實(shí)現(xiàn)時(shí)間和日期顯示,左對(duì)齊和對(duì)齊兩種效果,如下圖所示: 問(wèn)題分析 自定義view實(shí)現(xiàn)一般思路: (1)自定義一個(gè)View (2)編寫(xiě)values/attrs.…

安卓開(kāi)發(fā)自定義時(shí)間日期顯示組件

問(wèn)題背景

實(shí)現(xiàn)時(shí)間和日期顯示,左對(duì)齊和對(duì)齊兩種效果,如下圖所示:
在這里插入圖片描述

問(wèn)題分析

自定義view實(shí)現(xiàn)一般思路:
(1)自定義一個(gè)View
(2)編寫(xiě)values/attrs.xml,在其中編寫(xiě)styleable和item等標(biāo)簽元素
(3)在布局文件中View使用自定義的屬性
(4)在View的構(gòu)造方法中通過(guò)TypedArray獲取

問(wèn)題解決

話(huà)不多說(shuō),直接上代碼
(1)編寫(xiě)values/attrs.xml,組件定義left屬性

<?xml version="1.0" encoding="utf-8"?>
<resources><declare-styleable name="TimeClockView"><attr name="left" format="boolean"/></declare-styleable>
</resources>

(2)自定義View,代碼如下:

public class TimeClockView extends LinearLayout {boolean isLeft = true;public TimeClockView(Context context) {super(context);initView(context);}private void initView(Context context) {if (isLeft) {LayoutInflater.from(context).inflate(R.layout.layout_time_date,this);} else {LayoutInflater.from(context).inflate(R.layout.layout_time_date1,this);}}public TimeClockView(Context context, AttributeSet attrs) {super(context, attrs);initTypeValue(context,attrs);initView(context);}public void initTypeValue(Context context ,AttributeSet attrs){TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TimeClockView);isLeft = a.getBoolean(R.styleable.TimeClockView_left, true);a.recycle();}
}

(3)自定義view對(duì)應(yīng)的布局文件如下:
左對(duì)齊:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="wrap_content"android:layout_height="wrap_content"><TextClockandroid:id="@+id/time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:format12Hour="hh:mm"android:format24Hour="HH:mm"android:textSize="40px" /><TextClockandroid:id="@+id/date"android:layout_below="@id/time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:format12Hour="MM月dd日 E"android:format24Hour="MM月dd日 E"android:textSize="20px" />
</LinearLayout>

右對(duì)齊:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:gravity="end"android:orientation="vertical"android:layout_width="wrap_content"android:layout_height="wrap_content"><TextClockandroid:id="@+id/time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:format12Hour="hh:mm"android:format24Hour="HH:mm"android:textSize="40px" /><TextClockandroid:id="@+id/date"android:layout_below="@id/time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:format12Hour="MM月dd日 E"android:format24Hour="MM月dd日 E"android:textSize="20px" />
</LinearLayout>

(4)在頁(yè)面布局中,使用自定義的view

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"><com.baorant.mytestnew.view.TimeClockViewandroid:layout_marginLeft="90px"android:layout_marginTop="70px"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toTopOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content" /><com.baorant.mytestnew.view.TimeClockViewandroid:layout_marginRight="90px"android:layout_marginTop="70px"app:left="false"app:layout_constraintRight_toRightOf="parent"app:layout_constraintTop_toTopOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content"/></androidx.constraintlayout.widget.ConstraintLayout>
http://www.risenshineclean.com/news/48833.html

相關(guān)文章:

  • 什么是網(wǎng)絡(luò)營(yíng)銷(xiāo)包含哪些內(nèi)容全網(wǎng)營(yíng)銷(xiāo)與seo
  • 清理網(wǎng)站數(shù)據(jù)庫(kù)源碼交易平臺(tái)
  • 南昌那個(gè)公司做網(wǎng)站好今日最新國(guó)際新聞?lì)^條
  • 金昌網(wǎng)站seo合肥seo推廣培訓(xùn)班
  • 蘇州專(zhuān)業(yè)做網(wǎng)站公司有哪些小說(shuō)推廣關(guān)鍵詞怎么弄
  • 做網(wǎng)站需要的照片網(wǎng)站建設(shè)公司哪個(gè)好呀
  • 建站公司 萬(wàn)維科技外鏈交換平臺(tái)
  • 網(wǎng)站設(shè)置密碼百度網(wǎng)站域名注冊(cè)
  • 給企業(yè)做宣傳網(wǎng)站的好處百度上如何發(fā)廣告
  • 開(kāi)發(fā)平臺(tái)游戲名詞解釋搜索引擎優(yōu)化
  • 貴陽(yáng)疫情最新消息今天寧波seo排名優(yōu)化培訓(xùn)
  • 網(wǎng)站建設(shè)公司信息搜索引擎營(yíng)銷(xiāo)的優(yōu)勢(shì)和劣勢(shì)
  • 織夢(mèng)的手機(jī)端網(wǎng)站模板技能培訓(xùn)有哪些科目
  • 破解版下載大全免費(fèi)下載seo優(yōu)化軟件有哪些
  • 湛江免費(fèi)建站哪里有淘寶聯(lián)盟怎么推廣
  • 鄭州網(wǎng)站開(kāi)發(fā)設(shè)計(jì)公司電話(huà)個(gè)人如何優(yōu)化網(wǎng)站有哪些方法
  • 如何建立網(wǎng)站做微商企業(yè)網(wǎng)站模板 免費(fèi)
  • 多語(yǔ)種網(wǎng)站建設(shè)手機(jī)版怎么用百度快照
  • 馬鞍山住房和城鄉(xiāng)建設(shè)局網(wǎng)站免費(fèi)發(fā)帖論壇大全
  • 國(guó)內(nèi)ip地址代理免費(fèi)信息流優(yōu)化師簡(jiǎn)歷怎么寫(xiě)
  • 建立網(wǎng)站站點(diǎn)的步驟技術(shù)培訓(xùn)平臺(tái)
  • 做電影網(wǎng)站服務(wù)器需求seo導(dǎo)航站
  • 給網(wǎng)站做接口企業(yè)培訓(xùn)考試系統(tǒng)
  • 廬江有做網(wǎng)站的嗎財(cái)經(jīng)新聞每日財(cái)經(jīng)報(bào)道
  • 連江網(wǎng)站建設(shè)服務(wù)index百度指數(shù)
  • 高德地圖有外資背景嗎優(yōu)化大師官方
  • 煙臺(tái)網(wǎng)站建設(shè).comseo自然搜索優(yōu)化排名
  • 網(wǎng)站域名過(guò)期怎么做重慶網(wǎng)站快速排名提升
  • 大上海小程序開(kāi)發(fā)搜索引擎優(yōu)化的主題
  • 萬(wàn)維網(wǎng)的網(wǎng)站抖音優(yōu)化排名