xml -----之 style
16lz
2021-01-24
<style name="DavidStyleText2">
<item name="android:textSize">14sp</item>
<item name="android:textColor">#FF7F7C</item>
<item name="android:fromAlpha">0.0</item>
<item name="android:toAlpha">0.0</item>
</style>
这样可以样式化定义,就像css一样可以分离
在TextView中是这样的
<TextView
style="@style/DavidStyleText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:text="@string/str_text_view1"
/>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#FF7F7C</item>
<item name="android:fromAlpha">0.0</item>
<item name="android:toAlpha">0.0</item>
</style>
这样可以样式化定义,就像css一样可以分离
在TextView中是这样的
<TextView
style="@style/DavidStyleText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:text="@string/str_text_view1"
/>
更多相关文章
- android中如何自定义标题栏
- Android(安卓)关键资源的定义和使用
- Android(安卓)应用启动时去掉应用图标
- Android(安卓)OpenGL ES 开发教程(6):GLSurfaceView
- Android(安卓)自定义View
- Android中自定义checkbox样式
- Android(安卓)ApiDemos示例解析(166):Views->Layouts->TableLayo
- Android(安卓)ProgressBar 自定义动画