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

可以做图片视频的网站seo的含义

可以做图片视频的网站,seo的含义,网页设计展望怎么写,做网站的是干嘛的前言 原生 TabLayout 的指示器长度是充满整个屏幕的,但在实际开发中 UI 会设计成 指示器的长度等于或者小于标题字体长度,如图 如果设置成跟字体长度一样即使用 API: mTabLayout.setTabIndicatorFullWidth(false);或者在 xml 布局文件中的TabLayout标签…

前言

原生 TabLayout 的指示器长度是充满整个屏幕的,但在实际开发中 UI 会设计成 指示器的长度等于或者小于标题字体长度,如图

如果设置成跟字体长度一样即使用 API:

mTabLayout.setTabIndicatorFullWidth(false);

或者在 xml 布局文件中的TabLayout标签设置:

 app:tabIndicatorFullWidth=“false”


但如果想要指示器长度小于字体长度(如上图),API并未提供相关方法,此时就需要我们自定义一个CustomTabLayout 继承 TabLayout,允许开发者自定义选项卡的颜色、字体以及背景等属性。

二、自定义 View

public class CustomTabLayout extends TabLayout {private List<String> titles;private int mSelectColor = getResources().getColor(R.color.white);private int mUnSelectColor = getResources().getColor(R.color.c_80ffffff);public CustomTabLayout(Context context) {this(context,null);}public CustomTabLayout(Context context, AttributeSet attrs) {this(context, attrs,0);}public CustomTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CustomTabLayout);mSelectColor = array.getColor(R.styleable.CustomTabLayout_select_color, mSelectColor);mUnSelectColor = array.getColor(R.styleable.CustomTabLayout_unselect_color, mUnSelectColor);array.recycle();init();}private void init() {titles = new ArrayList<>();this.addOnTabSelectedListener(new OnTabSelectedListener() {@Overridepublic void onTabSelected(Tab tab) {/*** 设置当前选中的Tab为特殊高亮样式。*/if (tab != null && tab.getCustomView() != null) {TextView tab_layout_text = tab.getCustomView().findViewById(R.id.tv_tab_layout);View vIndicator = tab.getCustomView().findViewById(R.id.v_indicator);vIndicator.setVisibility(VISIBLE);vIndicator.setBackgroundColor(mSelectColor);tab_layout_text.setTextColor(mSelectColor);}}@Overridepublic void onTabUnselected(Tab tab) {/*** 重置所有未选中的Tab颜色、字体、背景恢复常态(未选中状态)。*/if (tab != null && tab.getCustomView() != null) {TextView tab_layout_text = tab.getCustomView().findViewById(R.id.tv_tab_layout);View vIndicator = tab.getCustomView().findViewById(R.id.v_indicator);vIndicator.setVisibility(INVISIBLE);tab_layout_text.setTextColor(mUnSelectColor);}}@Overridepublic void onTabReselected(Tab tab) {}});}public void setTitle(List<String> titles) {this.titles = titles;/*** 开始添加切换的Tab。*/for (String title : this.titles) {Tab tab = newTab();tab.setCustomView(R.layout.item_custom_tablayout);if (tab.getCustomView() != null) {TextView text = tab.getCustomView().findViewById(R.id.tv_tab_layout);text.setText(title);text.setTextColor(mUnSelectColor);}this.addTab(tab);}}
}

相关属性

styleable 
    <declare-styleable name="CustomTabLayout"><attr name="select_color" format="color"/><attr name="unselect_color" format="color"/></declare-styleable>
item_custom_tablayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="vertical"android:paddingBottom="@dimen/dimen_5"android:gravity="center_horizontal"><TextViewandroid:id="@+id/tv_tab_layout"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textStyle="bold"android:textColor="@color/c_80ffffff"android:textSize="@dimen/textsize_16"/><Viewandroid:id="@+id/v_indicator"android:layout_width="@dimen/dimen_30"android:layout_height="@dimen/dimen_3"android:visibility="invisible"android:layout_marginTop="@dimen/dimen_6"android:background="@color/white"/></LinearLayout>

使用方法

List<String> titles = new ArrayList<>();
titles.add("待签收");
titles.add("已签收");List<Fragment> mFragments = initFragments();
adapter = new ViewPaperAdapter(getSupportFragmentManager(), mFragments, titles);
mViewPager.setAdapter(adapter);mTabLayout.setTitle(titles);//Tablayout自定义view绑定ViewPager
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));
mTabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));

总结

如果对你有所帮助的话,不妨 点赞收藏
如果你有什么疑问的话,不妨 评论私信
青山不改,绿水长流 ,有缘江湖再见 ~

http://www.tj-hxxt.cn/news/68360.html

相关文章:

  • 大型门户网站制作教程站长之家ip地址查询
  • 如何在自己的电脑建设网站seo优化服务
  • 互联网创业就是做网站吗百度风云排行榜
  • 济南网站建设询问企优互联价低深圳seo推广公司
  • 锁定网站导航栏怎么去优化关键词
  • 网站开发技术路线怎么在百度做免费推广
  • 公司要招个做网站的人西安seo计费管理
  • 花生壳 建设网站网站seo技术能不能赚钱
  • 陕西网站建设公司山东关键词快速排名
  • 博客网站源码百度新闻app
  • 廉江人做寄生虫网站成都网络营销品牌代理机构
  • 两学一做 网站源码seo知识培训
  • 做网站基本教程淘宝网店代运营正规公司
  • 手机版网站有必要吗淄博信息港聊天室网址
  • php做的网站如何运行优化工作流程
  • 做购物车网站多少钱网站建设制作教程
  • wap网站制作怎么做免费搜索引擎推广方法有哪些
  • 怎么删除网站的死链网络广告的特点
  • 瀑布流网站有哪些自媒体营销代理
  • 和外国人做古玩生意的网站百度竞价价格
  • 欣赏别人做的网站十大网络推广公司排名
  • 禅城网站建设多少钱地推公司
  • 武汉搭建网站网站快速排名优化
  • 青岛网站建设青岛新思维个人网页制作教程
  • 网站创建过程品牌营销与推广
  • 在银行网站如何做理财风险评测公司员工培训内容有哪些
  • 广州做网站多少钱免费推广的网站平台
  • 建立网站的公司杭州网站推广怎么做才有效果
  • 顺德大良网站建设开发代发百度关键词排名
  • 好买卖做网站电话百度