Android中的样式
来源:互联网 发布:r语言与matlab 大数据 编辑:程序博客网 时间:2024/06/11 19:21
Android中可以自定义样式style,在布局文件中可以引用我们自定义的style。
在style.xml文件中自定义样式:
<style name="myStyle"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">0dp</item> <item name="android:layout_weight">1</item> <item name="android:padding">10dp</item> <item name="android:background">#f00</item> <item name="android:src">@drawable/bd_logo1</item> <item name="android:layout_marginTop">5dp</item> </style>在activity_main.xml中引用我们自定义的style:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="10dp" ><ImageView style="@style/myStyle"/> <ImageView style="@style/myStyle"/> <ImageView style="@style/myStyle"/> </LinearLayout>运行结果:
0 0
- Android中的自定义样式
- Android中的样式
- Android中的ProgressBar样式
- Android中的主题样式
- android中的样式和主题
- Android中的一些样式设置
- Android 中的样式与主题
- android中的样式和主题
- Android中的Activity常见样式
- android中的样式与主题
- Android初试--Android中的样式与主题
- android string.xml中的string样式总结
- android string.xml中的string样式总结
- Android中的主题(theme)和样式(style)
- Android中的样式与主题总结
- Android中的自定义主题和样式
- android string.xml中的string样式
- Android 自定义ListView中的Item样式
- 预处理指令(神秘的include#)
- LeetCode-Excel Sheet Column Title
- 虚拟机中 Linux下I cannot start the X server的问题
- 圆柱的自动旋转
- pycharm调用远程虚拟环境的设置
- Android中的样式
- Android Wear Eclipse开发环境搭建
- Datacamp Notes: Introduction to R
- rsync: mkstemp ".test1.sh.ox5lBz" (in conf) failed: Permission denied (13)
- Android Studio导入library project第三方类库
- view 与viewGroup的关系
- 归并排序的简单实现(c++ 版本)
- freescale spi driver
- 关于今晚的实验 自己做出来的 满满的成就感感觉自己棒棒哒