当前位置:网站首页>Custom view subtotal
Custom view subtotal
2022-06-13 06:34:00 【Sindyue】
1.java Dimensions used in code , Avoid : Don't reverse the order of the parameters
- setTextSize(TypedValue.COMPLEX_UNIT_PX,15); //22 Pixels
- setTextSize(TypedValue.COMPLEX_UNIT_SP,15); //22SP
- setTextSize(TypedValue.COMPLEX_UNIT_DIP,15);//22DIP
2.java The code is read dimens The value in
<dimen name="default_size">21dp</dimen>
Screen information : width:480 height:800 density:1.5 densityDpi:240
getDimension(): 31.500000 --- return float value
getDimensionPixelSize(): 32 --- The actual value returned is rounded
getDimensionPixelOffset(): 31 --- The actual value returned is the decimal point after the result
3. Get the width and height of the string
private int getStringHeight(String string, Paint paint) {
Rect rect = new Rect();
paint.getTextBounds(string, 0, string.length(), rect);
return rect.height();
}
private int getStringWidth(String string, Paint paint) {
Rect rect = new Rect();
paint.getTextBounds(string, 0, string.length(), rect);
return rect.width();
}
边栏推荐
- Use of kotlin basic common sets list, set and map
- Analysis of synchronized
- [FAQs for novices on the road] understand program design step by step
- Simple use of event bus
- Wechat applet: use of global state variables
- Kotlin data flow - flow
- 'ipconfig' is not an internal or external command, nor is it a runnable program or batch file.
- Echart histogram: stacked histogram displays value
- Echart histogram: echart implements stacked histogram
- Omron Ping replaces the large domestic product jy-v640 semiconductor wafer box reader
猜你喜欢

SSM integration

Local file search tool everything

Explication détaillée du triangle Yang hui

Kotlin collaboration channel

华为开发者认证与DevEco Studio编译器下载

电镀挂具RFID工序管理解决方案

无刷直流电机矢量控制(四):基于滑模观测器的无传感器控制

RN Metro packaging process and sentry code monitoring

Hbuilderx: installation of hbuilderx and its common plug-ins

Download and installation of universal player potplayer, live stream m3u8 import
随机推荐
c语言对文件相关的处理和应用
Basic knowledge of knowledge map
Failed to extract manifest from apk: processexception:%1 is not a valid Win32 Application.
【sketchup 2021】草图大师中CAD文件的导入与建模(利用cad图纸在草图大师中建立立面模型)、草图大师导出成品为dwg格式的二维、三维、立面效果到cad中打开预览】
MFS explanation (V) -- MFS metadata log server installation and configuration
Wechat applet (function transfer parameters, transfer multiple parameters, page Jump)
Kotlin collaboration - start and cancel, scope
PHP redis makes high burst spike
Echart rectangular tree diagram: simple implementation of rectangular tree diagram
欧姆龙平替国产大货—JY-V640半导体晶元盒读写器
Detailed explanation of the player startup process of ijkplayer code walkthrough 2
端午安康,使用祝福话语生成词云吧
347. top k high frequency elements heap sort + bucket sort +map
Kotlin basic objects, classes and interfaces
二分查找
synchronized浅析
App performance test: (III) traffic monitoring
BlockingQueue source code
电镀挂具RFID工序管理解决方案
[FAQs for novices on the road] about technology management