您的位置:首页 > 移动开发 > Android开发

android style举例

2015-11-22 23:28 323 查看
<resources>

<style name="AppBaseTheme" parent="android:Theme.Light"></style>

<style name="AppTheme" parent="AppBaseTheme"></style>
<style name="mystyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">#A1B9E7</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">#F15963</item>
<item name="android:text">hehe</item>
</style>

</resources>


<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" >

    <TextView style="@style/mystyle" />

    <TextView style="@style/mystyle" />

    <TextView style="@style/mystyle" />

    <TextView style="@style/mystyle" />

    <TextView style="@style/mystyle" />

</LinearLayout>


结果

样式可以继承,加上这句

 <style name="mystyle" parent="@style/AppBaseTheme">
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: