PagerSlidingTabStrip 高亮选中标题
1、选中标题后,高亮标题
@Override
public void onPageSelected(int position) {
setSelectTextColor(position);
if (delegatePageListener != null) {
delegatePageListener.onPageSelected(position);
}
}
private void setSelectTextColor(int position) {
for (int i = ; i < tabCount; i++) {
View view = tabsContainer.getChildAt(i);
if (view instanceof ImageButton) {
} else if (view instanceof RelativeLayout) {
View viewText = ((RelativeLayout) view).getChildAt();
TextView tabTextView = (TextView) viewText;
if (viewText instanceof TextView) {
if (position == i) {
tabTextView.setTextColor(自定义颜色);
} else {
tabTextView.setTextColor(tabTextColor);
}
}
}
}
}
2、首次进入默认第一个标题高亮,关键标红代码
private void updateTabStyles() {
for (int i = ; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof RelativeLayout) {
View v1 = ((RelativeLayout) v).getChildAt();
if (v1 instanceof TextView) {
TextView tab = (TextView) v1;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
if (i == 0) {
tab.setTextColor(自定义颜色);
} else {
tab.setTextColor(tabTextColor);
}
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
}
}
}
}
PagerSlidingTabStrip 高亮选中标题的更多相关文章
- IOS中tableView每组的头部控件、通过tableView的代理方法控制某一行的cell能否达到高亮选中状态
一.tableView每组的头部控件 1.控件宽度默认就是tableView的宽度 2.控件高度由下面的代理方法决定 - (CGFloat)tableView:(UITableView *)table ...
- Android中使用开源框架PagerSlidingTabStrip实现导航标题
此开源框架官网地址:https://github.com/astuetz/PagerSlidingTabStrip 可以理解为配合ViewPager使用的交互式页面指示器控件. 话不多说,先上效果图: ...
- textarea中文本高亮选中
最近在实现原文/译文句段高亮对比显示,和有道翻译类似,如下图所示: 最初的解决方案是采用富文本编辑器,把所有句段信息都用HTML标签包裹,操作空间比较大,页面上需要的功能几乎都可以实现,但是由此带来了 ...
- jquery单选框 复选框表格高亮 选中
单选框: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/T ...
- 高亮选中MEMO某一行
选中第5行 //转到指定行并选中这行的文本 procedure SelectLine(Memo1: TMemo; ln: Integer); begin Memo1.SelStart := SendM ...
- delphi 高亮选中MEMO某一行
http://www.delphitop.com/html/kongjian/2641.html选中第5行 //转到指定行并选中这行的文本 procedure SelectLine(Memo1: TM ...
- eclipse高亮选中属性以及更改颜色
1.显示: 1.1.工具栏里有个黄色小笔的图标,点一下就好了 1.2.打开对话框windows->preference,在左上角输入mark Occurrencs 把右边都选 ...
- 在触发器中,当“IsMouseOver”属性=true时,设置当前控件的高亮选中效果
<Style.Triggers> <!--<Trigger Property="IsSelected" Value="Tru ...
- 问题:CListCtrl如何高亮选中一行 http://zhidao.baidu.com/question/100664911.html 扩展:单行、双行及完成状态的字体等等。。。
http://zhidao.baidu.com/link?url=BKp05mfOdKbEBh21svQelpVhYjzDkIpYUZay8_3ZLSndTQn5kK0eTwQG8jBvYnwh8US ...
随机推荐
- What is the difference between supervised learning and unsupervised learning?
Machine Learning is a class of algorithms which is data-driven, i.e. unlike "normal" algor ...
- HDOJ-1999 不可摸数
不可摸数 转自:http://www.cnblogs.com/dongsheng/archive/2012/08/18/2645594.html Time Limit: 2000/1000 MS (J ...
- JsRender系列demo-对null 和boolen类型数据的探讨
废话不说了,直接上代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <he ...
- Asp.Net缓存(1)
知其根本,方能应用.MSDN上的缓存讲解.先看原来讲解. Asp.Net缓存概述 通常,应用程序可以将那些频繁访问的数据,以及那些需要大量处理时间来创建的数据存储在内存中,从而提高性能. 在这些情况下 ...
- java基础知识回顾之---java String final类之intern方法
public class StringObjectDemo { /** * @param args */ public static void main(String[] args) { String ...
- CHM类型API文件打不开问题解决方法
这是CHM文档被锁定导致的问题,选择CHM文件,右键属性,解除锁定
- 内存对齐-C语言struct内存占用问题
转1个写的比较全面的. http://hubingforever.blog.163.com/blog/static/17104057920122256134681/ 本文编辑整理自:http://hi ...
- 用 EasyBCD 在 Win7/8 中硬盘安装 Ubuntu
写在前面: 1. 我装的是ubuntu 13.10 64位,不一样的地方是,从casper文件夹复制出来的文件不是vmlinuz,而是vmlinuz.efi,相应的,menu.lst里也要将vmlin ...
- dbgrid显示access备注信息
procedure TfrmAllFind.DBGrid6DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; C ...
- QString->string->wstring->LPCWSTR
QFileInfo info("./records.db"); std::string str = info.absoluteFilePath().toStdString(); / ...