PowenKo, Android Tutorial 19-20, Dialog, Custom dialog.

December 22, 2011   ·   0 Comments

device-2011-12-22-141607

custom_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/current_stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible">
<ImageView android:id="@+id/player_image"
    android:src="@drawable/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"/>
<TextView
    android:id="@+id/player_name"
    android:layout_below="@id/player_image"
    android:layout_centerHorizontal="true"
    android:text="PowenKo.com"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
<ImageButton android:id="@+id/dialog_close"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:background="#00000000"
    android:src="@drawable/icon"/>
<ImageButton android:id="@+id/dialog_flip"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:background="#00000000"
    android:src="@drawable/icon"/>
</RelativeLayout>

values\style.xml

<resources>
    <style name="FullHeightDialog" parent="android:style/Theme.Dialog">
   <item name="android:windowNoTitle">true</item>
</style>
</resources>

package com.powenko;



import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Gravity;

public class Tutorial_Dialog_CustomActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Fun_custom_dialog();
    }
    private void Fun_custom_dialog(){
    	Dialog dialog = new Dialog(this, R.style.FullHeightDialog);
    	//Dialog  dialog = new Dialog(this); //(this,android.R.style.Theme_Translucent_NoTitleBar);

         dialog.setContentView(R.layout.custom_dialog);


          dialog.show();
    }
}
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon