码迷,mamicode.com
首页 > 移动开发 > 详细

android之style使用demo

时间:2014-10-22 18:32:15      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:style dialog


private void showDialog(){


final Dialog dialog = new Dialog(MainActivity.this, R.style.my_style);

dialog.setContentView(R.layout.help);

dialog.show();


ImageView imgView = (ImageView) dialog.findViewById(R.id.imageView_help);

imgView.setOnClickListener(new OnClickListener(){

@Override

public void onClick(View arg0) {

dialog.dismiss();

}

});

}


help.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="vertical" >


    <ImageView

        android:id="@+id/imageView_help"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:background="@drawable/help" />


</LinearLayout>


strings.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>


    <string name="app_name">TestView</string>

    <string name="action_settings">Settings</string>

    <string name="hello_world">Hello world!</string>


    <style name="my_style">

        <item name="android:windowBackground">@color/back_color</item>

        <item name="android:windowNoTitle">true</item>

        <item name="android:windowIsTranslucent">true</item>

        <item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>

    </style>

    

</resources>


color.xml

<?xml version="1.0" encoding="utf-8"?>

<resources>


    <drawable name="darkgray">#808080</drawable>

    <color name="back_color">#FF00FF</color>

    <color name="top">#33CCFF</color>

    <color name="top_background">#33CCFF</color>


</resources>


本文出自 “爬过山见过海” 博客,请务必保留此出处http://670176656.blog.51cto.com/4500575/1566766

android之style使用demo

标签:style dialog

原文地址:http://670176656.blog.51cto.com/4500575/1566766

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!