Tampilkan postingan dengan label overlayDialog. Tampilkan semua postingan
Tampilkan postingan dengan label overlayDialog. Tampilkan semua postingan

Using DialogFragments in Android

Posted by Unknown Minggu, 17 Februari 2013 0 komentar
MainActivity.java :
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm = getSupportFragmentManager();
dialogfragment testDialog = new dialogfragment();
testDialog.setRetainInstance(true);
testDialog.show(fm, "fragment_name");
}}
Dialogfragment.java :
public class Dialogfragment extends DialogFragment {    
public void TestDialog() {
// Empty constructor required for DialogFragment
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog, container);
return view;
} }
dialog.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/lbl_your_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello from Mark's Playground, DialogFragment Demo"/>
</LinearLayout>

  


Baca Selengkapnya ....

Creating an Activity as a Dialog Box

Posted by Unknown Rabu, 23 Januari 2013 0 komentar
In Android ManifestFile :


<activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog"> </activity>

Baca Selengkapnya ....

Custom AlertBox in Android

Posted by Unknown Rabu, 16 Januari 2013 0 komentar
in main.xml file:

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

< Button
android:id="@+id/button1"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Button" />

< /LinearLayout>
in dialog.xml :(xml for custom dialog box) :

< ?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/imageView1"
android:layout_width="210dp"
android:layout_height="232dp"
android:padding="40dp"
android:src="@drawable/flower" />

< TextView
android:id="@+id/textView1"
android:layout_width="147dp"
android:layout_height="wrap_content"
android:text="This is a flower"
android:textSize="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"/>

< /LinearLayout>
in java file:

Button b= (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog d=new Dialog(CustomdialogActivity.this);
d.setContentView(R.layout.dialog);
d.setTitle("This is important");
d.show();
}
});


Baca Selengkapnya ....

Disabling the Touch of an Activity

Posted by Unknown Senin, 07 Januari 2013 0 komentar

On a button click we are creating the same class as a dialog so that the touch is not received


public class MainActivity extends Activity {
Dialog overlayDialog;
EditText edt;
Button bt;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

edt=(EditText)findViewById(R.id.editText1);
bt=(Button)findViewById(R.id.button1);
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
disableAnyInput();
}
});
}
public void disableAnyInput(){
Toast.makeText(getApplicationContext(), "This will disable any input. Click the backbutton "
+ "to enable any input.", Toast.LENGTH_LONG).show();
overlayDialog = new Dialog(MainActivity.this,android.R.style.Theme_Panel);
overlayDialog.setCancelable(true);
overlayDialog.show();
} }

Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.