文件dimens.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <!--打印内容间距离--> <dimen name="print_content_margin_bigger">30px</dimen> <dimen name="print_content_margin_greater">24px</dimen> <dimen name="print_content_margin_standard">16px</dimen> <dimen name="print_content_margin_small">5px</dimen> <!--打印内容字体大小--> <dimen name="print_line_size_standard">24px</dimen> <dimen name="print_text_size_standard">22px</dimen> <dimen name="print_text_size_greater">22px</dimen> <dimen name="print_text_size_small">18px</dimen> <dimen name="print_text_size_normal">20px</dimen> <dimen name="print_text_size_big">24px</dimen> <dimen name="print_text_size_cardno">28px</dimen> <dimen name="print_text_size_head">35px</dimen> <dimen name="print_text_size_max_big">35px</dimen> <dimen name="small_padding">5dp</dimen> <dimen name="content_bg_padding">10dp</dimen> <dimen name="content_padding_small">10dp</dimen> <!-- 凭单宽度 --> <dimen name="receipt_width">384px</dimen>
</resources>
文件space.xml
<resources> <dimen name="space_3dp">3dp</dimen> <dimen name="space_5dp">5dp</dimen> <dimen name="space_6dp">6dp</dimen> <dimen name="space_10dp">10dp</dimen> <dimen name="space_11dp">11dp</dimen> <dimen name="space_12dp">12dp</dimen> <dimen name="space_13dp">13dp</dimen> <dimen name="space_14dp">14dp</dimen> <dimen name="space_15dp">15dp</dimen> <dimen name="space_17dp">17dp</dimen> <dimen name="space_18dp">18dp</dimen>
<dimen name="large_15_text_size">15sp</dimen> <dimen name="large_16_text_size">16sp</dimen> <dimen name="large_17_text_size">17sp</dimen> <dimen name="large_18_text_size">18sp</dimen> <dimen name="large_20_text_size">20sp</dimen> <dimen name="large_22_text_size">22sp</dimen> <dimen name="large_24_text_size">24sp</dimen> <dimen name="large_25_text_size">25sp</dimen> <dimen name="large_35_text_size">35sp</dimen> </resources>
在XML中的调用方式:
TextView android:id="@+id/tv_print_state" android:layout_width="match_parent" android:layout_height="wrap_content"
android:padding="@dimen/space_15dp"
android:textSize="@dimen/large_18_text_size" />