如何在Android电视应用程序中设置画中画(PiP)的位置?

如何在Android电视应用程序中设置画中画(PiP)的位置?,android,android-8.0-oreo,android-tv,android-picture-in-picture,Android,Android 8.0 Oreo,Android Tv,Android Picture In Picture,是否有办法将画中画(PiP)窗口置于屏幕的右上角(或其他位置),而不是右下角(默认情况下)?或者以编程方式设置确切位置?我认为没有关于更改窗口位置的文档,除非您拖动窗口本身 PIP窗口显示在屏幕的最顶层,以 由系统选择的角点。您可以将PIP窗口拖动到另一个窗口 地点。当您点击窗口时,会出现两个特殊控件:a 全屏切换(在窗口中央)和关闭按钮 (右上角有一个“X”) 请参阅下面的提交,此设置有助于“config_DefaultPictureInputPictureGravity” 您可以参考以找出所

是否有办法将画中画(PiP)窗口置于屏幕的右上角(或其他位置),而不是右下角(默认情况下)?或者以编程方式设置确切位置?

我认为没有关于更改窗口位置的文档,除非您拖动窗口本身

PIP窗口显示在屏幕的最顶层,以 由系统选择的角点。您可以将PIP窗口拖动到另一个窗口 地点。当您点击窗口时,会出现两个特殊控件:a 全屏切换(在窗口中央)和关闭按钮 (右上角有一个“X”)


请参阅下面的提交,此设置有助于“config_DefaultPictureInputPictureGravity”

您可以参考以找出所需的值

e、 g.Gravity.TOP | Gravity.RIGHT为0x35

commit 06868c37df46c0c973a96a0a25b1f301384db4be
Author: Winson <winsonc@google.com>
Date:   Wed Oct 12 21:08:18 2016 -0700

    Changing initial PIP bounds specifications.
    
    - Change from a absolute bounds to a size, gravity and inset to
      allow easier tweaking of initial pinned stack bounds.
    
    Test: android.server.cts.ActivityManagerPinnedStackTests
    Test: #testPinnedStackDefaultBounds
    Test: #testPinnedStackMovementBounds
    
    Change-Id: I82a102bbd2d83259c6c84915071d1a16728e3aa7

diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index c40436a5bda..30dcfb081d8 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2482,8 +2482,17 @@
          -->
     <integer name="config_navBarOpacityMode">0</integer>
 
-    <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
-    <string translatable="false" name="config_defaultPictureInPictureBounds">"0 0 100 100"</string>
+    <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
+         These values are in DPs and will be converted to pixel sizes internally. -->
+    <string translatable="false" name="config_defaultPictureInPictureScreenEdgeInsets">10x10</string>
+
+    <!-- Max default size [WIDTHxHEIGHT] on screen for picture-in-picture windows to fit inside.
+         These values are in DPs and will be converted to pixel sizes internally. -->
+    <string translatable="false" name="config_defaultPictureInPictureSize">216x135</string>
+
+    <!-- The default gravity for the picture-in-picture window.
+         Currently, this maps to Gravity.BOTTOM | Gravity.RIGHT -->
+    <integer name="config_defaultPictureInPictureGravity">0x55</integer>
提交06868C37DF46C0C973A96A0A25B1F301384DB4BBE
作者:温森
日期:星期三10月12日21:08:18 2016-0700
更改初始PIP边界规范。
-从绝对边界更改为大小、重力和插入到
允许更轻松地调整初始固定堆栈边界。
测试:android.server.cts.ActivityManager InnedStackTests
测试:#testPinnedStackDefaultBounds
测试:#testPinnedStackMovementBounds
更改Id:I82a102bbd2d83259c6c84915071d1a16728e3aa7
diff——git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
索引c40436a5bda..30dcfb081d8 100644
---a/core/res/res/values/config.xml
+++b/core/res/res/values/config.xml
@@ -2482,8 +2482,17 @@
-->
0
-    
-    "0 0 100 100"
+    
+10x10
+
+    
+216x135
+
+    
+0x55