欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

利用Android如何實現(xiàn)對ToolBar進行整合

本篇文章給大家分享的是有關(guān)利用Android如何實現(xiàn)對 ToolBar進行整合,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

成都創(chuàng)新互聯(lián)公司堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的嵩明網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

CustomeToolBar繼承原生ToolBar

package com.ldm.imitatewx;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import android.widget.Toolbar;

/**
 * Created by John on 2017/2/16.
 */

public class CustomeToolBar extends Toolbar {
 private TextView mTvMainTitleLeft;
 private TextView mTvMainTitle;
 private TextView mTvMainRight;
 public CustomeToolBar(Context context) {
 super(context);
 }

 public CustomeToolBar(Context context, AttributeSet attrs) {
 super(context, attrs);
 }

 public CustomeToolBar(Context context, AttributeSet attrs, int defStyleAttr) {
 super(context, attrs, defStyleAttr);
 }

 @Override
 protected void onFinishInflate() {
 super.onFinishInflate();
 mTvMainTitleLeft= (TextView) findViewById(R.id.lt_main_title_left);
 mTvMainTitle= (TextView) findViewById(R.id.lt_main_title);
 mTvMainRight= (TextView) findViewById(R.id.lt_main_title_right);
 }
 //設(shè)置主title內(nèi)容
 public void setMainTitle( String text )
 {
 this.setTitle(" ");
 mTvMainTitle.setVisibility(View.VISIBLE);
 mTvMainTitle.setText(text);
 }
 //設(shè)置主title的內(nèi)容文字的顏色
 public void setTitleColor(int color )
 {
 mTvMainTitle.setTextColor(color);
 }
 //設(shè)置左邊title內(nèi)容
 public void setMainTitleLeft(String text )
 {
 mTvMainTitleLeft.setVisibility(View.VISIBLE);
 mTvMainTitleLeft.setText(text);
 }
 //設(shè)置左邊的title顏色
 public void setMainTitleLeftColor(int color )
 {
 mTvMainTitleLeft.setTextColor(color);
 }
 //設(shè)置左邊icon
 public void setMainTitleLeftDrawable(int res )
 {
 Drawable left= ContextCompat.getDrawable(getContext(),res);
 left.setBounds(0,0,left.getMinimumWidth(),left.getMinimumHeight());
 mTvMainTitleLeft.setCompoundDrawables(left,null,null,null);
 }
 //設(shè)置右邊的title
 public void setTvMainRightText(String text )
 {
 mTvMainRight.setVisibility(View.VISIBLE);
 mTvMainRight.setText(text);
 }
 //設(shè)置右邊標題的顏色
 public void setMainTitleRightColor(int color )
 {
 mTvMainRight.setTextColor(color);
 }
 //設(shè)置右邊icon
 public void setMainTitleRightDrawable(int res )
 {
 Drawable right= ContextCompat.getDrawable(getContext(),res);
 right.setBounds(0,0,right.getMinimumWidth(),right.getMinimumHeight());
 mTvMainTitleLeft.setCompoundDrawables(right,null,null,null);
 }
 //設(shè)置toolbar顏色
 public void setToolBarBackground(int res )
 {
 this.setBackgroundResource(res);
 }
 //設(shè)置ToolBar左邊的圖標
 public void setToolbarLeftBackImageRes(int res )
 {
 this.setNavigationIcon(res);
 }
 //設(shè)置toolbar左邊文字
 public void setToolbarLeftText(String text ){
 this.setNavigationContentDescription(text);
 }
 //設(shè)置toolbar標題
 public void setToolbarTitle(String text )
 {
 this.setTitle(text);
 }
 //設(shè)置toolbar顏色
 public void setToolbarTitleColor(int color )
 {
 this.setTitleTextColor(color);
 }
 //設(shè)置ToolBar子標題
 public void setToolbarSubTitleText(String text )
 {
 this.setSubtitle(text);
 }
 //設(shè)置toolbar子標題的顏色
 public void setToolbarSubTitleTextColor(int color )
 {
 this.setSubtitleTextColor(color);
 }

}

然后布局引用activity_custome_toolbar
因為其實toolbar說白也是view也可以說是一個布局
所以我們只要根據(jù)自己需求往里面丟東西就ok,這里可能不全面,希望大家一起完善謝謝!

<&#63;xml version="1.0" encoding="utf-8"&#63;>
<com.ldm.imitatewx.CustomeToolBar xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="&#63;attr/label_textSize"
 android:background="@android:color/holo_green_light"
 android:fitsSystemWindows="true"
 app:contentInsetLeft="0dp"
 app:contentInsetStart="0dp"
 app:popupTheme="@style/MyPopStyle"
 >
 <TextView
 android:id="@+id/lt_main_title_left"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginLeft="10dp"
 android:text="返回"
 android:gravity="center"
 android:drawableLeft="@drawable/ic_back_u"
 android:textColor="@android:color/white"
 android:singleLine="true"
 android:textSize="16sp"
 android:visibility="visible"/>
 <TextView
 android:id="@+id/lt_main_title"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="center"
 android:singleLine="true"
 android:textColor="@android:color/white"
 android:text="標題"
 android:textSize="20sp"
 android:visibility="visible"
 />
 <TextView
 android:id="@+id/lt_main_title_right"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="right"
 android:layout_marginRight="10dp"
 android:text="返回"
 android:gravity="center"
 android:drawableRight="@drawable/ic_add"
 android:textColor="@android:color/white"
 android:singleLine="true"
 android:textSize="16sp"
 android:visibility="visible"/>

</com.ldm.imitatewx.CustomeToolBar>

以上就是利用Android如何實現(xiàn)對 ToolBar進行整合,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

本文名稱:利用Android如何實現(xiàn)對ToolBar進行整合
文章URL:http://aaarwkj.com/article36/jegipg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站商城網(wǎng)站、響應(yīng)式網(wǎng)站關(guān)鍵詞優(yōu)化、網(wǎng)頁設(shè)計公司、App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務(wù)器托管
婷婷国产成人精品一区二| 亚洲女人下体毛茸茸视频| 国产大片在线观看一区二区| 天天干天天干夜夜操| 国产不卡一区不卡二区| 国产av综合一区二区三区最新 | 成年女人毛片免费观看不卡| 国产麻豆剧传媒精品av| 99久久婷婷免费国产综合精品 | 亚洲区自拍偷拍一区二区| 成人午夜激情在线免费观看| 亚洲免费一区二区三区四区| 日日插天天干夜夜操| 高清在线一区二区在线| 日韩不卡一区二区在线观看| 免费97久久人妻一区精品| 亚洲一区二区三区熟妇| 久久日韩一区二区三区| 久久精品人妻少妇一区二| 91福利社区欧美大片| 日韩黄色一级片在线观看| 国产黄片自拍视频免费看| 日本加勒比中文在线观看| 亚洲激情视频在线视频| 97精品国产高清在线| 久久精品国产久精国产爱| 91精品一久久香蕉国产| 无遮挡动漫网站免费观看| 日韩欧美在线一区二区| 欧美一区二区国产精品日韩| 国产日韩视频一区二区| 精品久久久久久久久无| 国产高清不卡av在线| 亚洲码av一区二区三区| 中文字幕日韩人妻一二三区| 日韩亚洲欧美另类精品| 末满18周岁禁止观看| 熟妇人妻久久中文字幕麻豆网| 麻豆国产国语精品三级在线观看| 亚洲欧洲成熟熟女妇专区乱| 播放欧美日韩特黄大片|