设置图片颜色 tabBarVCtrl.tabBar.selectedImageTintColor = [UIColor greenColor];//设置tabBarItem选中时的字图颜色,iOS 8.0中没有该属性(若设置,会出现警告) 设置title颜色 [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSFore…
实现了一下内容: 1.设置tabBarItem选中及非选中时的图片,图片充满item; 2.调整了 tabBar 高度; 3.改变了title颜色及位置. ------------代码如下: ---TabBarC.m--- #import "TabBarC.h" #import "ViewController.h" #import "SecViewController.h" #define CustomTabBarHeight 60//不需要改变…
现在很多应用都使用到了tabBar,我们往往在给tabBar设置图片和字体的时候,当选中状态下,往往字体的颜色和图片的颜色不匹配,有时候就显得无从下手,我也常常忘了,所有写这个博客的目的,相当于给自己做个笔记,也希望给有需要的朋友们一点帮助.写了个小demo,来演示这个问题: 写了个小demo,来演示这个问题: - (void)viewDidLoad { [super viewDidLoad]; ZYGroupBuyViewController *group = [[ZYGroupBuyView…
android中在java代码中设置Button按钮的背景颜色 1.设置背景图片,图片来源于drawable: flightInfoPanel.setBackgroundDrawable(getResources().getDrawable(R.drawable.search_label_click)); 2.转换字符串为int(颜色): listItemView.deleteFilghtBg.setBackgroundColor(Color.parseColor("#F5F5DC")…
1.在info.plist中添加View controller-based status bar appearance,值为NO 2.在设置状态栏的地方添加代码 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; 3.大功告成 4.title颜色     [self.navigationController.navigationBar setTitleTex…
版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 在Android开发中,经常需要设置控件的背景颜色或者图片的src颜色. 效果图 代码分析 根据使用的方法不同,划分为 setBackgroundColor方法[一般用于RelativeLayout.TextView等控件] 使用colors.xml文件中的颜色 使用颜色的int类型值 使用颜色的16进制类型值 setImageDrawable方法[一般用于ImageView控件] 使用colors.xml文件中的颜色 使用颜色的int…
UILabel* label = [[UILabel alloc] init]; label.frame = CGRectMake(0, 100, 200, 100); label.textColor = [UIColor blackColor]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"1234567890"]; NSRange range = NSMak…
Android代码中设置字体大小,字体颜色,显示两种颜色 在xml文件中字体大小用的像素 <TextView android:id="@+id/uppaid_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:layout_cente…
NavigationView menu默认icon和title会随着菜单状态改变而改变,选择某个菜单后再次打开侧边菜单后会发现该菜单的icon和title会变成应用的主颜色,其他菜单项仍然为黑色. 如果想关闭系统默认的这个效果,有两种方式: 1. XML布局文件设置 <android.support.design.widget.NavigationView android:id="@+id/mainNavView" android:layout_width="wrap_…
必须在Android4.4以上版本才能设置状态栏颜色: 一.在单个Activity里面,设置状态栏的背景: 效果: 1.在Activity的布局根文件中添加属性: android:fitsSystemWindows="true" //不设置此属性,标题栏和系统状态栏会重叠 2.将第三方核心代码类 SystemBarTintManager 复制到自己的项目: /* * * Licensed under the Apache License, Version 2.0 (the "…