Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 移动我的应用程序窗口?_Android_Window_Move - Fatal编程技术网

Android 移动我的应用程序窗口?

Android 移动我的应用程序窗口?,android,window,move,Android,Window,Move,我们有一个android应用程序,然后将宽度和高度作为wrap\u内容 我的XML代码是main.XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_cont

我们有一个android应用程序,然后将宽度和高度作为
wrap\u内容

我的XML代码是main.XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:contentDescription="Move" />
</LinearLayout>
我的
MoveApplication Manifest.xml
代码是

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.move"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="15" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MoveApplicationActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.DeviceDefault.Dialog.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

请写出我的示例代码,不要忘记将这一粗体行添加到
Manifest.xml

android:theme=“@android:style/theme.DeviceDefault.Dialog.NoActionBar”

我不知道,如何移动应用程序窗口。请以编程方式指导我


提前谢谢。

你不能用正常的方式来做这件事

一个活动将覆盖整个屏幕,您无法更改它

您可以尝试创建一个具有透明主题的活动。然后,您可以创建具有特定宽度和高度的DialogFragment

这将使你的应用程序在实际占据整个屏幕时看起来有一定的尺寸


不过,我认为您无法控制DialogFragment位置的X、Y坐标。

我不太确定通过移动可以为我提供什么……我的应用程序窗口宽度大小为50,高度大小为50。所以我的应用程序窗口非常小。如何将我的应用程序按
X和Y
方向移动。这就是如何移动烤面包片的位置。虽然我不知道你的情况,但这可能会对你有所帮助。final Toast def=Toast.makeText(getActivity(),“Toasty!”,Toast.LENGTH_LONG);设定重力(0,0,-200);我不是在问祝酒词。例如,我的android移动设备大小为240*400。我的应用程序窗口大小是50*50。移动窗口方向(x,y)
setOnTouchListener()。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.move"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="15" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MoveApplicationActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.DeviceDefault.Dialog.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>