当前位置:网站首页>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();
}
边栏推荐
- The boys x pubgmobile linkage is coming! Check out the latest game posters
- Custom view
- [JS] array flattening
- Time complexity and space complexity
- [var const let differences]
- Wechat applet (get location)
- Intelligent digital asset management helps enterprises win the post epidemic Era
- Detailed explanation of the player network data reading process of ijkplayer code walkthrough 2
- The processing and application of C language to documents
- Analysis of synchronized
猜你喜欢

Jetpack - basic use of room
![[DP 01 backpack]](/img/be/1e5295684ead652eebfb72ab0be47a.jpg)
[DP 01 backpack]

二分查找

【Kernel】驱动编译的两种方式:编译成模块、编译进内核(使用杂项设备驱动模板)

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

Solutions to common problems in small program development

【新手上路常见问答】关于技术管理

【2022高考季】作为一个过来人想说的话

Download and installation of universal player potplayer, live stream m3u8 import

Super model logo online design and production tool
随机推荐
JetPack - - - Navigation
[solution] camunda deployment process should point to a running platform rest API
Thread correlation point
[DP 01 backpack]
Win10 drqa installation
Download and installation of universal player potplayer, live stream m3u8 import
Kotlin foundation extension
You should consider upgrading via
App performance test: (III) traffic monitoring
MFS详解(六)——MFS Chunk Server服务器安装与配置
Error in downloading opencv from pip
JVM Foundation
Wechat applet: basic review
[virtual machine] VMware virtual machine occupies too much space. Solution
Uniapp (upload local pictures, preview pictures, convert Base64 format, upload audio files)
Using the shutter floor database framework
华为开发者认证与DevEco Studio编译器下载
Failed to extract manifest from apk: processexception:%1 is not a valid Win32 Application.
Simple use of event bus
Echart line chart: multiple line charts show only one line at a time