android button 行间距,android – 如何减少TextView行间距
我试图通过设置TextView.setLineSpacing()的负“添加”来减少TextView中的行间距.除了底线被截断之外,它运行良好.
主要布局
android:id="@+id/text_view"
android:padding="dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
tools:context=".MainActivity" />
主要活动:(注意
package com.font_test;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Typeface typeface = Typeface.createFromAsset(getAssets(),"fonts/custom_fonts.ttf");
final TextView tv = (TextView) findViewById(R.id.text_view);
tv.setTypeface(typeface);
tv.setTextSize(60);
tv.setLineSpacing(-30f,1f); // *** -30 to reduce line spacing
tv.setBackgroundColor(0x280000ff);
tv.setText("gggkiiikkk" + "\n" + "gikgikgik" + "\n" + "kigkigkig");
}
}
这导致在视图底部截断(注意底线的’g’):
似乎问题与错误的布局测量有关.如果我将TextView设置为
android:layout_height="fill_parent"
它确实正确呈现:
知道怎么解决吗?如果它有帮助,我不介意有丑陋的变通方法.我也可以访问FontForge,如果需要我可以修改字体文件.
android button 行间距,android – 如何减少TextView行间距相关推荐
- android 计算行间距,android – 如何减少TextView行间距
我试图通过设置TextView.setLineSpacing()的负"添加"来减少TextView中的行间距.除了底线被截断之外,它运行良好. 主要布局 android:id=&q ...
- kotlin button_使用Kotlin和XML的Android Button
kotlin button In this tutorial, we'll learn how to create a Button in Android apps using Kotlin prog ...
- Android Button 属性介绍与使用
一.简介 Button 控件继承 TextView,拥有 TextView 的属性. StateListDrawable 是 Drawable 资源的一种,可以根据不同的状态,设置不同的图片效果,关键 ...
- android radiogroup清空,android RadioGroup的使用方法
创建一个MainActivity.java的主类 android:layout_width="fill_parent" android:layout_height="fi ...
- Android商城排版,android排版布局学习
Android开发学习之路--UI之基本布局 android使用shape stroke描边只保留底部 RadioGroup的使用 一.项目粮仓 粮仓学习: liangcang: 启动页面:act_s ...
- android中段落距离,Android中TextView 行间距和段间距设置
这里有一篇文章关于设置段落间距(仅供参考):https://blog.csdn.net/yingpaixiaochuan/article/details/77996793 TextView行间距设置 ...
- Android中TextView 行间距和段间距设置
这里有一篇文章关于设置段落间距(仅供参考):https://blog.csdn.net/yingpaixiaochuan/article/details/77996793 TextView行间距设置 ...
- Android TextView行间距解析
TextView行间距设置 在布局XML中有两个参数可以对TextView的行间距进行设置. 分别为:Android:lineSpacingExtra 和 android:lineSpacingMul ...
- Android中的基础控件TextView、Button、ImageView、EditText、ProgressBar
文章目录 1 Android中的基础控件 1.1 控件的通用属性 2 TextView 2.1 TextView的继承关系 2.2 TextView的常用属性 3 EditText 3.1 常用属性 ...
最新文章
- 如何使用Azure ML Studio开启机器学习
- 热议:这样的开源项目,你会支持吗?
- saltstack (1) 简介
- Eclipse的JQuery提示插件-Spket(别试了,没什么效果,且安装设置麻烦)
- java 中对象引用,以及对象赋值
- python赋值浅拷贝和深拷贝的区别_浅拷贝、深拷贝和普通赋值操作有什么区别?...
- Spring Boot之发送HTTP请求(RestTemplate详解)
- CF285D.Permutation Sum
- linux管道和tee命令
- caffe android lib
- DSP实验二c语言程序,实验1.2:编写一个以C语言为基础的DSP程序
- C++中读写文件demo
- python处理Excel数据串行串列问题
- 云服务器搭网站需要买域名吗,买了云服务器还要买域名吗
- java 地铁线路_个人项目-地铁出行路线规划(Java代码实现)
- 如何自制虚拟直播,在里分享3种方法,总有一个你喜欢
- Ubuntu16.04无法连接Wifi解决方案 (绝对有效)
- PDF可以通过OCR图文识别软件转换为JPEG图像吗
- 数学类笔试题(四分位数、数据规约和协方差)
- 在VS中添加lib的三种方法