如何将我的WPF应用程序带到桌面的前端?到目前为止,我已经尝试过:
SwitchToThisWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle, true);
SetWindowPos(new WindowInteropHelper(Application.Current.MainWindow).Handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetForegroundWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle);
Run Code Online (Sandbox Code Playgroud)
这些都没有Marshal.GetLastWin32Error()成功(说这些操作成功完成,每个定义的P/Invoke属性都有SetLastError=true).
如果我创建一个新的空白WPF应用程序,并SwitchToThisWindow使用计时器调用,它完全按预期工作,所以我不知道为什么它不能在我的原始情况下工作.
编辑:我正在与全球热键一起做这个.
我这样做:
toolbar = (Toolbar) findViewById(com.sports.unity.R.id.tool_bar);
setSupportActionBar(toolbar);
setTitle("hello");
Run Code Online (Sandbox Code Playgroud)
我想在标题"hello"中为文本设置自定义字体.怎么做?
我正在尝试将类似的状态栏和导航栏渐变设置为Google Now.
图像参考:矩形区域如下所示
在Android Marshmallow上尝试以下选项后,
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
Run Code Online (Sandbox Code Playgroud)
我得到以下行为
图片参考:
谁能建议我如何在这两个上获得渐变?
那是一个渐变还是阴影?
在 Android O中新的"固定快捷方式"功能的文档中,他们提到"您还可以创建一个专门的活动,帮助用户创建快捷方式,完成自定义选项和确认按钮".
我尝试按照文档进行操作,但是当我尝试创建新的快捷方式时,我只看到了默认对话框,而不是我的活动.
这是Manifest中的声明:
<activity android:name=".ShortcutActivity">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
PS
在文档中,他们还在Gmail应用程序中显示了一个示例 - 如何进入该屏幕?我想看看流程,但我找不到它.
我正在使用ROOM并且正在尝试获取具有特定Card.Code.
实体类就像这样
@Entity(tableName = "vehicles")
data class Vehicle(
@PrimaryKey
@ColumnInfo(name = "id") val id: Int,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "cards") val cards: List<Card>?
)
@Entity
data class Card(
@ColumnInfo(name = "id") val id: Int,
@ColumnInfo(name = "code") val code: String
)
Run Code Online (Sandbox Code Playgroud)
我的问题是我不知道如何正确编写 SQL 查询
我有下一个麻烦
该gridview模块必须在您的Yii配置文件中设置,并且必须是的实例kartik\grid\Module。
我不知道如何配置我的配置文件。在我的配置文件中,我有这个:
'modules' => [
'gridview' => ['class' => 'kartik\grid\Module']
],
Run Code Online (Sandbox Code Playgroud)
但这找不到
我正在尝试将手机中的媒体播放到ExoPlayer中。我正在从Environment.getExternalStorageDirectory().getAbsoluteFile();
每当我尝试播放媒体时-我都会收到此错误-
源错误com.google.android.exoplayer2.upstream.HttpDataSource $ HttpDataSourceException:无法连接到/storage/emulated/0/Download/big_buck_bunny_720p_1mb.mp4
也,
引起原因:java.net.MalformedURLException:无协议:/storage/emulated/0/Download/big_buck_bunny_720p_1mb.mp4
我在这里经过乌里 MediaSource mediaSource = buildMediaSource(Uri.parse(link));
这种方法正在使用Uri
private MediaSource buildMediaSource(Uri uri) {
DataSource.Factory dataSourceFactory = new
DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER);
DashChunkSource.Factory dashChunkSourceFactory = new
DefaultDashChunkSource.Factory(dataSourceFactory);
return new DashMediaSource(uri, dataSourceFactory,
dashChunkSourceFactory, null, null);
}
Run Code Online (Sandbox Code Playgroud)
这就是我获得链接的方式
arrayList1 = video(Environment.getExternalStorageDirectory().getAbsoluteFile());
protected ArrayList<File> video(File file) {
File[] filename = file.listFiles();
ArrayList<File> arrayList2 = new ArrayList<File>();
try {
for (File file1 : filename) {
if (file1.isDirectory()) {
arrayList2.addAll(video(file1));
} else {
if (file1.getName().endsWith(".mp4")) {
arrayList2.add(file1);
}
}
}
}catch (Exception …Run Code Online (Sandbox Code Playgroud)