Note that there are some explanatory texts on larger screens.

plurals
  1. PODialog Box Moving in android?
    primarykey
    data
    text
    <p>I have been move the dialog box. Here I am posted my complete source code and Screen shots. Why my dialog box has been lost some part.</p> <p>Code :</p> <pre><code>public class MoveDialogBox extends Activity { Dialog dialog; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialog(1); } }); } @Override protected Dialog onCreateDialog( int id ) { switch ( id ) { case 1: AlertDialog.Builder builder = null; Context mContext = this; LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.info, (ViewGroup) findViewById(R.id.root)); Button exit = (Button) layout.findViewById(R.id.exit); exit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismissDialog(1); } }); final LinearLayout LL = (LinearLayout) layout.findViewById(R.id.root); LL.bringToFront(); LL.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { double X = event.getX(); double Y = event.getY(); String.valueOf(event.getX() + "x" + String.valueOf(event.getY())); Toast.makeText(getBaseContext(), X + " : " + Y, Toast.LENGTH_SHORT).show(); LL.bringToFront(); LL.setX((float) X); LL.setY((float) Y); return false; } }); builder = new AlertDialog.Builder(mContext); builder.setView(layout); dialog = builder.create(); dialog.setCanceledOnTouchOutside(true); break; } return dialog; } } </code></pre> <p>XML Code : info.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/holo_blue_light" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/about_Title" android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" android:textSize="25dip" android:textColor="@android:color/white" android:textStyle="bold|italic" android:text="Android" /&gt; &lt;Button android:id="@+id/exit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Exit" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>XML Code : main.xml</p> <pre><code>&lt;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:background="@drawable/androidimage" &gt; &lt;Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Open Dialog Box" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Screen Shot : 1 <br/> <img src="https://i.stack.imgur.com/IzxAr.png" alt="enter image description here"> <br/>Screen Shot : 2 <br/> <img src="https://i.stack.imgur.com/Ysxe3.png" alt="enter image description here"> <br/>Screen Shot : 3 <br/> <img src="https://i.stack.imgur.com/WzWkB.png" alt="enter image description here"> <br/>Please help some one how do move the dialog box in the entire screen.</p> <p>Where I am Mistaken. How do solve.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload