导航:首页 > 操作系统 > android文字加粗

android文字加粗

发布时间:2022-05-10 22:32:49

‘壹’ android怎样对listview中的textview设置中文加粗,textStyle只英文有效

首先在res/drawable目录下写个配置文件作为各种状态的样式配置,命名bg这个随便:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android=" http://schemas.android.com/apk/res/android">
<item android:state_focused="false" state_focused="false" android:state_pressed="false" android:state_selected="false"
android:color="@drawable/white" />
<item android:state_focused="true" android:state_pressed="true"
android:color=
"@drawable/black" />
<item android:state_focused="false" android:state_pressed="true"
android:color="@drawable/black" />
<item android:state_selected="true"
android:color="@drawable/black" />
<item android:state_focused="true"
android:color="@drawable/black" />
</selector>

然后在写ListView选项配置文件的时候吧上面写的配置文件添加给这个选项配置文件:
<TextView android:id="@+id/tt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="要显示的文本"
android:textSize="字体大小"
android:textColor="@drawable/bg"<--!此bg就是上面的配置文件名-->"
/>

‘贰’ 手机wps加粗在哪

手机wps加粗在哪?wps Word字体加粗可在开始菜单中找到,具体加粗字体的方法为:
1、首先打开一个WPS Word文档,然后切换到开始页面。

2、接着选中需要加粗的文字,在状态栏中点击加粗按钮“B”即可。

WPS for Android是WPS Office的安卓版,是一款办公软件套装,可以实现办公软件最常用的文字、表格、演示等多种功能。该软件具有内存占用低,运行速度快,体积小巧等优点。WPS具有强大的插件平台支持,可以免费提供海量在线存储空间及文档模板,支持阅读和输出PDF文件。

WPS Office个人版对个人用户永久免费,包含 WPS文字、WPS表格、WPS演示三大功能模块,与MS Word、MS Excel、MS PowerPoint一一对应,应用XML 数据交换技术,无障碍兼容doc.xls.ppt等文件格式,你可以直接保存和打开 Microsoft Word、Excel 和 PowerPoint 文件,也可以用 Microsoft Office轻松编辑WPS系列文档。WPS 仅仅只有MS的12分之1,它在不断优化的同时,体积依然保持小于同类软件,不必耗时等待下载,也不必为安装费时头疼,几分钟即可下载安装,启动速度较快,让你的办公速度“飞起来”。遵循 Windows 7主流设计风格的2012新界面,metro风格的2013界面,并且有两种色彩风格,清新蓝、素雅黑,加之传统的2012和2003风格,赋予你焕然一新的视觉享受。WPS 2013充分尊重用户的选择与喜好,提供四界面切换,用户可以无障碍的在新界面与经典界面之间转换,熟悉的界面、熟悉的操作习惯呈现,无需再学习。

‘叁’ Android Toast可以自定义,有没有对Toast里面的字体进行,加粗,改变大小,斜体。

可以在Toast里增加一个TextView然后对TextView做字体加粗,大小设置。
1.字体加粗
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//加粗
textView.getPaint().setFakeBoldText(true);//加粗

2.字体大小
textView.setTextSize(500);

3.字体斜体
SpannableString sp = new SpannableString( "斜体文本" ); //设置斜体
sp.setSpan( new StyleSpan(android.graphics.Typeface.BOLD_ITALIC), 0 , tmp.length() , Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
textView.setText(sp);

‘肆’ Android中在actionbar中点击了某一个menuitem,之后就需要让这个menuitem上的文字加粗显示

加到我的控件的ID,然后在代码中进行点击监听应该是可以改变字体粗细的.
TextView tv = (TextView)findViewById(R.id.tv);
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);

‘伍’ android 如何设置中文粗体,我试了在xml文件中使用android:textStyle="bold" 可以将英文设置成粗体,但是

设置是对的,只是系统自带的字体中文显示粗体不明显,实在要区别的话,可以自己附带字体

‘陆’ android 在xml的textStyle中 如何设置一个字体即是粗体又是斜体又带有下划线

设置字体的时候可以这样用的
android:textStyle="bold|……"
多个选项中间可以用|分开的

‘柒’ android 怎么设置textview指定的字符加粗显示

普通:
textview.setText("hello, 你好吗");

加粗:
textview.setText(Html.fromHtml("hello, <b>你好吗</b>"));

‘捌’ android手机程序开发怎样设置手机字体,比如:设置成宋体或楷体android有个功能

Android系统自带有对字体的设置,这些设置是对字体的显示方式的设置,比如加粗,倾斜,下划线,字号等,但是对于字体本身,比如设置为楷体,隶书等没有。Android系统只有一种默认的,如果需要修改字体,或者引用自己喜欢的字体,那么就需要自己设置或修改。
最简单的修改系统的字体的方法就是可以下载可以修改字体的app。网上或者手机自带的应用中心里去搜索吧。

‘玖’ 如何设置 android.support.design.widget.tablayout的选择的文本进行加粗显示

1.首先导入库:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'

2. 然后就是 布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".TabLayoutActivity">

<android.support.design.widget.TabLayout
android:id="@+id/tl_tabs"
style="@style/MyCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<android.support.v4.view.ViewPager
android:id="@+id/vp_viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@android:color/white"/>
</LinearLayout>
3. 这里将TabLaoyut的样式设置放入到了style文件中了,颜色神马的就不贴了
如果在布局中使用属性, 带tab开头的属性使用"app:"前缀而不是"andorid:"前缀
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout"> <!--Tablayout 使用的样式-->
<item name="tabMaxWidth">@dimen/tab_max_width</item> <!--TAB最大宽度-->
<item name="tabIndicatorColor">?attr/colorAccent</item> <!--TAB底部滑块颜色-->
<item name="tabIndicatorHeight">5dp</item> <!--TAB底部滑块高度-->
<item name="tabPaddingStart">12dp</item> <!--TAB左边padding-->
<item name="tabPaddingEnd">12dp</item> <!--TAB右边padding-->
<item name="tabBackground">?attr/selectableItemBackground</item> <!--TAB背景色-->
<item name="tabTextAppearance">@style/MyCustomTabTextAppearance</item> <!--TAB文字样式-->
<item name="tabSelectedTextColor">?android:textColorPrimary</item> <!--TAB选中文字颜色-->
</style>
<style name="MyCustomTabTextAppearance" parent="TextAppearance.Design.Tab"> <!--TAB文字样式-->
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="textAllCaps">false</item> <!--英文大写,默认true-->
</style>
<dimen name="tab_max_width">36dp</dimen>
</resources>

4.然后就是Activity文件了
public class TabLayoutActivity extends AppCompatActivity {
private ViewPagerAdapter viewPagerAdapter;
private ViewPager viewPager;
private TabLayout tl;
private static final String POSITION = "position";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tablayout);
viewPager = (ViewPager) findViewById(R.id.vp_viewpager);
tl = (TabLayout) findViewById(R.id.tl_tabs);
}

@Override
protected void onResume() {
super.onResume();
viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(viewPagerAdapter);
tl.setupWithViewPager(viewPager); //ViewPager 和 TabLayout 关联
tl.setTabMode(TabLayout.MODE_SCROLLABLE); //用于多个TAB, Tablayout可以滚动
//更改TAB默认的文本布局,自定义TAB布局
for (int i = 0; i < tl.getTabCount(); i++) {
TabLayout.Tab tabAt = tl.getTabAt(i);
tabAt.setCustomView(viewPagerAdapter.getTabView(i));
}
viewPagerAdapter.notifyDataSetChanged();
}

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(POSITION, tl.getSelectedTabPosition());
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
viewPager.setCurrentItem(savedInstanceState.getInt(POSITION));
}
}

5. 然后就是ViewPager的Adapter了
private class ViewPagerAdapter extends FragmentPagerAdapter {
int pageCount = 10;
private int color[] = new int[]{R.color.orange, R.color.green, R.color.red,
R.color.color_grays, R.color.color_red, R.color.color_black,
R.color.color_furvous, R.color.color_blue, R.color.color_green,R.color.color_orange
};

public ViewPagerAdapter(FragmentManager supportFragmentManager) {
super(supportFragmentManager);
}

@Override
public Fragment getItem(int position) {
return ViewPagerFragment.getInstance(position + 1, color[position]);
}

@Override
public int getCount() {
return pageCount;
}

@Override
public CharSequence getPageTitle(int position) {
// if (position == 4) {
// Drawable img = getResources().getDrawable(R.drawable.ic_one);
// img.setBounds(0, 0, img.getIntrinsicWidth(), img.getIntrinsicHeight());
// SpannableString sb = new SpannableString("Page" + (position + 1) + " ");
// ImageSpan imageSpan = new ImageSpan(img, ImageSpan.ALIGN_BASELINE);
// sb.setSpan(imageSpan, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// return sb;
// }else{
// return "Page" + (position + 1);
// }
return null; //如果采用自定义TAB布局,则这里返回null就可以了
}
//引入TAB自定义布局
public View getTabView(int position) {
View view = View.inflate(TabLayoutActivity.this, R.layout.tab_item, null);
TextView tv = (TextView) view.findViewById(R.id.tv);
ImageView iv = (ImageView) view.findViewById(R.id.iv);
tv.setText("Page" + (position + 1));
if (position == 5) {
iv.setVisibility(View.VISIBLE);
} else {
iv.setVisibility(View.GONE);
}
return view;
}
}

6.然后可能重要的就是Fragment了

public class ViewPagerFragment extends BaseFragment {
public int page;
private int color;
public static final String GETPAGE = "get_page";
public static final String GETCOLOR = "get_color";
private static List<ViewPagerFragment> frags = new ArrayList<>();
private View rootView;
public static Fragment getInstance(int page, int color) {
ViewPagerFragment cacheFrag = null;
cacheFrag = getCacheFrag(page, cacheFrag);
if (cacheFrag != null){
return cacheFrag; //首先尝试获取缓存的Fragment
}

Bundle args = new Bundle();
args.putInt(GETPAGE, page);
args.putInt(GETCOLOR, color);
//new 一个Fragment
ViewPagerFragment pageFragment = new ViewPagerFragment();
pageFragment.setArguments(args);
frags.add(pageFragment);
return pageFragment;
}
//获取缓存的Fragment
private static ViewPagerFragment getCacheFrag(int page, ViewPagerFragment cacheFrag) {
if (frags != null && frags.size() > 0){
for (ViewPagerFragment frag : frags){
if (frag.page == page){
cacheFrag = frag;
break;
}
}
}
return cacheFrag;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
page = getArguments().getInt(GETPAGE);
color = getArguments().getInt(GETCOLOR);
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.i(this.getClass().getSimpleName(), "onCreateView");
if(rootView == null) {
rootView = inflater.inflate(R.layout.layout_fragment, container, false);
TextView tv = (TextView) rootView.findViewById(R.id.tv_fragment);
tv.setText("Page=====>" + page);
rootView.setBackgroundResource(color);
}
//缓存的rootView需要判断是否已经被加过parent, 如果有parent需要从parent删除,
//要不然会发生这个rootview已经有parent的错误。
ViewGroup parent = (ViewGroup) rootView.getParent();
if (parent != null){
parent.removeView(rootView);
}
return rootView;
}
}

‘拾’ android textview字体加粗 多少

Android中字体加粗
一、在xml文件中使用android:textStyle=”bold”

二、但是不能将中文设置成粗体,将中文设置成粗体的方法是:

TextView tv = (TextView)findViewById(R.id.TextView01);
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);

阅读全文

与android文字加粗相关的资料

热点内容
框架源码研读 浏览:444
仙侣奇缘3如何架设服务器 浏览:952
单片机RRC指令 浏览:887
默认加密文件密码 浏览:3
怎么用反诈中心app查询电话 浏览:708
linuxvi操作 浏览:296
什么是实木压缩板 浏览:639
加密空投与硬分叉指南 浏览:15
加密wps文档密码忘了怎么办 浏览:685
冲程算法 浏览:988
鸡料与鸡粪的算法 浏览:833
phpif变量为空值 浏览:59
iot编译器异常 浏览:600
代理服务器被禁用怎么上网 浏览:411
隐私加密怎么设置密码 浏览:940
马丁靴补色解压 浏览:565
在设置app上怎么找到个人热点 浏览:754
按照档案号生成文件夹 浏览:1001
程序员转方向 浏览:111
lol敏捷加密 浏览:882