android字体加粗
㈠ Android textview 怎么实现点击后中文字体变粗的效果和点击后出现阴影的效果
下面是自己做的一个效果,可以拷贝到自己的项目里面看看,因为网络原因就不上传结果图了
1.MainActivity.java
packagecom.example.a07;
importandroid.app.Activity;
importandroid.graphics.Color;
importandroid.graphics.Typeface;
importandroid.os.Bundle;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.widget.TextView;
{
privateTextViewtv;
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv=(TextView)this.findViewById(R.id.tv);
tv.setOnClickListener(newOnClickListener(){
@Override
publicvoidonClick(Viewarg0){
//粗体
tv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//模糊度//阴影离开文字的x横向距离//y距离//阴影颜色
tv.setShadowLayer(1F,20F,-20F,Color.GRAY);
}
});
}
}
2.activity_main.xml
<LinearLayoutxmlns: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">
<TextView
android:id="@+id/tv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text="点击后中文字体变粗的效果和点击后出现阴影的效果"
android:textSize="25sp"/>
</LinearLayout>
满意请采纳
㈡ 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就是上面的配置文件名-->"
/>
㈢ 安卓字体怎么加粗
设置 显示 字体(仅供参考)
㈣ Android中TextView设置字体很大后会变得很粗,怎样实现放大后字体保持粗细不变。
自己做数字的图啊,0-9也就10个图片啊,android的字体是死的,没有办法
㈤ 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);
㈥ 安卓字体的自动加粗怎么办
步骤:系统设置——显示——手机字体
我还没有root权限,所以具体情况也不清楚,能帮你的只有这样,你试一下看能不能调。
望采纳。
㈦ android 在xml的textStyle中 如何设置一个字体即是粗体又是斜体又带有下划线
设置字体的时候可以这样用的
android:textStyle="bold|……"
多个选项中间可以用|分开的
㈧ textview可以设置字体的粗体 斜体吗
1、设置TextView中文本的样式(如:颜色、斜体等),可以针对不同位置的文本设置不同的样式
(如:将索引范围在1-3的字符设置为黑色,2-6的字符设置为粗体等)
myFirstTextView = (TextView)findViewById(R.id.myFirstTextView);
myFirstTextView.setText("这是我的第一个TextView,嘿嘿",BufferType.EDITABLE);
/**
* 要设置文本的背景色,
* 必须将文本设置成BufferType.SPANNABLE,BufferType.EDITABLE
*/
Spannable sp = (Spannable) myFirstTextView.getText();
//设置红色背景
sp.setSpan(new BackgroundColorSpan(Color.RED), 3, 8,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
sp.setSpan(new StyleSpan(android.graphics.Typeface.BOLD_ITALIC),
0, 7, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //设置斜体
myFirstTextView.setText(sp);
复制代码
2、实现文本超链接
/************
* 设置超链接
* 在layout/*.xml中设置TextView属性:android:autoLink="all" 即可
* 支持:web/phone/email/map/all/none
* *******/
hyperlinkTextView = (TextView)findViewById(R.id.hyperlinkTextView);
hyperlinkTextView.setText("my blog -> http://orgcent.com");
复制代码
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/main"
android:textSize="65px"
/>
可以
可以在XML里面加一句话
android:textSize=""
或者
在
mTextView.setTextSize(size);
㈨ android studio怎么让xml字体不加粗
Android Studio 默认编辑器(Editor)的方案(Scheme)是无法修改字体的, 可以Save as, 保存为新的方案(Scheme), 然后更改字体大小; 位置: File->Settings->IDE Settings->Editor->Colors & Fonts -> Font