我正在编写一个Wifi Direct游戏,但是当一个用户拒绝加入连接的邀请时,WifiP2pDevice状态遇到了问题.
不应该将状态转移回电话A上显示的AVAILABLE状态?我刷新了可用设备列表,但状态保持不变.即使我重新启动应用程序,它仍会显示电话B的状态为受邀者?
这是否应该基于WifiDirect的API发生?还是我错过了什么?
编辑:更多信息
在BroadcastReciever,当意图是WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION,然后使用实现PeerListListener,这只是打印可用设备和这些设备的信息(包括状态)列表的片段经理要求同行.因此,当电话A使用manager.connect()发送邀请时,它会将状态更改为INVITED.但如果电话B拒绝,状态仍为INVITED.这些状态是在notifyDataSetChanged()上触发的.这不是关于代码的问题,而是wifi如何直接确定和更改设备的状态.但如果需要,我可以提供代码.
我正在运行以下代码:
pyinstaller --onefile main.py
Run Code Online (Sandbox Code Playgroud)
main.py好像:
import sys
import os
sys.path.append(r'C:\Model\Utilities')
from import_pythonpkg import *
......
Run Code Online (Sandbox Code Playgroud)
import_pythonpkg.py好像:
from astroML.density_estimation import EmpiricalDistribution
import calendar
import collections
from collections import Counter, OrderedDict, defaultdict
import csv
....
Run Code Online (Sandbox Code Playgroud)
通过运行pyinstalleron main.py,main.exe文件已成功创建。
但是当我运行时main.exe它给出了错误astroML。如果我转到astroMLfrom main.py,import_pythonpkg.py则 不会出现错误astroML。现在我收到错误csv。
即如果我将其更改main.py为:
import sys
from astroML.density_estimation import EmpiricalDistribution
import os
sys.path.append(r'C:\Model\Utilities')
from import_pythonpkg import *
......
Run Code Online (Sandbox Code Playgroud)
当我运行时,错误astroML不再存在main.exe。 …
下面的表格要大得多,但为了便于提问而缩小了尺寸
表 1 - Exercise_rolladex
Exercise_ID | Exercise_Name
---------------------------
1 Pushups
2 Turkish Get Ups
3 Squats
4 Ice Skater
Run Code Online (Sandbox Code Playgroud)
表 2 - Exercise_planes
Exercise_Plane_ID | Exercise_Plane
----------------------------------
1 Sagittal
2 Frontal
3 Transverse
Run Code Online (Sandbox Code Playgroud)
表 3 - Exercise_has_planes
Exercise_ID | Exercise_Plane_ID
-------------------------------
1 1
2 1
2 2
2 3
3 1
4 2
4 3
Run Code Online (Sandbox Code Playgroud)
我的问题是:如何构建一个查询,在其中我可以找到每个练习的 Exercise_ID,其中有 Exercise_Plane_ID=1 和 Exercise_Plane_ID=2。换句话说,找到同时具有矢状面和额状面运动平面的练习。
正确的查询
SELECT e.Exercise_Name, p.Exercise_Plane
FROM exercise_rolladex e
INNER JOIN exercise_has_planes h ON h.Exercise_ID=e.Exercise_ID
INNER JOIN exercise_planes p ON p.Exercise_Plane_ID=h.Exercise_Plane_ID …Run Code Online (Sandbox Code Playgroud) 我的键盘有问题。当它消失时,它所占据的空间将保持空白,并且布局的其余部分不会调整
正常屏幕:

带键盘:

键盘已关闭:

我之前从未见过,所以我什至不知道从哪里开始寻找。这发生在4.2.2和5.1
另一个重要的信息是这是一个自定义的LinearLayout,其中包含所有内容。也许与此有关。如有必要,我可以上传任何代码。
这是主布局文件外壳。
<com.edgetechlabs.app_v2.MasterLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Menu (Drawer)-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:visibility="visible"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/activity_main_menu_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/drawer_background"
android:cacheColorHint="#00000000" >
</ScrollView>
</LinearLayout>
<!-- Fragment Holder -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- This is where fragment will show up -->
<FrameLayout
android:id="@+id/fragment_master"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的清单文件
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MasterActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud) 我有一个简单的导航栏:
<nav class="navbar navbar-inverse navbar-toggleable-md fixed-top custom-navbar" style="background-color: #321048;">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav d-flex justify-content-end" style="width:100%">
<li class="nav-item">
<a class="nav-link" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#rolfing">Rolfing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#packages">Packages</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#footer">Contact</a>
</li>
</ul>
</div>
</nav>
Run Code Online (Sandbox Code Playgroud)
对于所有屏幕尺寸,一切都按预期工作.
我想对切换器进行正确的证明,因为菜单是正确的.因此,根据Bootstrap 4 alpha 6,我补充道
navbar-toggler-right
Run Code Online (Sandbox Code Playgroud)
按钮,它确实正确地对齐按钮,但导航栏本身不再扩展以填充按钮.所以切换按钮看起来只是浮动.我满足于让navbar-toggler-right让它工作,但我只是好奇它为什么会这样做.与navbar-toggler-right有关,也许有绝对的位置.navbar-toggler-left也做同样的事情.
编辑 为了提供更多细节,切换按钮位于左侧或右侧并不重要.添加类navbar-toggler-left会导致同样的问题.我的问题不是如何将切换按钮向右移动(我可以通过添加浮动:向右按钮来实现),但为什么导航栏切换器左右类具有这种奇怪的行为.