我正在做一个聊天应用程序,我正在使用参考字体很棒的图标字体,我将ttf文件保存到我的项目资产文件夹中,之后我通过设置字体来访问图标,问题是我想更改图标的大小,颜色字体。请帮助我
<TextView
android:id="@+id/landing_drawer_image"
android:layout_width="@dimen/width_40"
android:layout_height="@dimen/height_40"
android:layout_marginLeft="@dimen/margin_15"
android:textColor="@color/grey_black_1000"
android:gravity="center_vertical"
android:text="Drawable"
/>
viewHolder.drawerItemImage.setText("A");
您可以尝试这样:
在您的colors.xml中设置颜色:
<color name="test">#0f0f0f</color>
在您的XML中执行以下操作:
<TextView
android:id="@+id/landing_drawer_image"
android:layout_width="@dimen/width_40"
android:layout_height="@dimen/height_40"
android:layout_marginLeft="@dimen/margin_15"
android:textColor="@color/test"
android:gravity="center_vertical"
android:text="Drawable"
/>
要进行设置,TypeFace
您可以通过两种方式完成
1.-
Typeface font = Typeface.createFromAsset(
getContext().getAssets(),
"fonts/YourTypeFace.ttf");
YourTextView.setTypeface(font);
2- android:typeface="YOURTTF"
要进行设置,您TextSize
必须添加xml文件
android:textSize="@dimen/font_size"/>
试试这个,如果您有任何问题让我知道,希望我的回答以某种方式对您有所帮助:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句