我正在尝试使平视通知工作。通知已创建,但未显示在应用程序顶部。这是负责构建通知的代码:
Notification notification = new NotificationCompat.Builder(context)
.setSmallIcon(android.R.drawable.arrow_up_float)
.setContentTitle("Check running time - click!")
.setContentText(String.valueOf(elapsedTime))
.setContentIntent(pendingIntent)
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(Notification.PRIORITY_HIGH)
.setVibrate(new long[0])
.build();
Run Code Online (Sandbox Code Playgroud)
我试图运行该应用程序的设备是API21。我已经看到很多线程,但是没有给出的解决方案适合我。
由于SDK API 23(Marshmallow)中的权限存在一些问题,我想切换回API 21,但我遇到了一些问题......我已经阅读了很多有类似问题的帖子并试过(几乎我猜)一切:我已经更新了所有SDK构建/平台工具,API 21,Suport和Repository Libraries的功能.然后我清理了项目,重建并同步.然而,我收到了这些错误:

我的build.gradle如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.pablo.appcontacts"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
Run Code Online (Sandbox Code Playgroud)
我对此不是很熟悉,任何人都可以帮我解决这个问题我真的找不到办法......?
我遇到过一些奇怪的行为RichTextBox。我希望它是,但是当我使用方法加载文件readonly时它不显示图像
。如果不是,则文件会正确加载并显示图像。我正在使用 Windows 窗体。richTextBox.LoadFile(path).rtfreadonly
我可以以某种方式弥补它还是另一个RTB错误?目前,作为一种解决方法,我在RTB获得焦点时使用标签将焦点移至其上,但我不太喜欢这个。
我正在制作一个简单的 WinForms 应用程序,我想允许用户从 RichTextBox 打印文本。
然后我按照MSDN链接..它适用于真正的打印机(真正的我的意思是我可以触摸的:))
但是如果我想使用某种 PDF 打印机怎么办?那么我必须说它在只打印一页时有效。接下来的每一页都打印在同一页第一页上,这意味着文本被叠印。这是显而易见的,但我能做什么强制 PDF 打印机创建一个新页面?
这是我的代码:
private PrintDocument docToPrint;
private string stringToPrint;
public mainForm()
{
InitializeComponent();
CenterToScreen();
this.docToPrint = new PrintDocument();
(...)
}
private void tsBtnPrint_Click(object sender, EventArgs e)
{
PrintDialog myPrintDialog = new PrintDialog();
myPrintDialog.AllowCurrentPage = true;
myPrintDialog.AllowSelection = true;
myPrintDialog.AllowSomePages = true;
myPrintDialog.Document = docToPrint;
if(myPrintDialog.ShowDialog()==DialogResult.OK)
{
StringReader reader = new StringReader(this.richTextBox.Text);
stringToPrint = reader.ReadToEnd();
this.docToPrint.PrintPage += new PrintPageEventHandler(this.docToPrintCustom);
this.docToPrint.Print();
}
}
private void docToPrintCustom(object sender, …Run Code Online (Sandbox Code Playgroud) 我看过一些关于这个主题的主题,但没有一个适合我的情况。在我的 Windows 窗体应用程序中,我有一个Resources包含一些图像和.rtf文件的普通目录。它看起来像这样:
我从中加载图片没有问题:
Bitmap bmp = Properties.Resources.Cut_6523;
Run Code Online (Sandbox Code Playgroud)
但是,由于某种原因,我无法对.rtf文件执行相同的操作(仅位图可用)。
我究竟做错了什么?
我正在学习如何使用Espresso进行UI测试,并且想验证意图状态。我写的是这样的:
intended(allOf(
hasAction(equalTo(Intent.ACTION_VIEW)),
hasCategories(hasItem(equalTo(Intent.CATEGORY_BROWSABLE))),
hasData(hasHost(equalTo("www.google.com"))),
hasExtras(allOf(
hasEntry(equalTo("key1"), equalTo("value1")),
hasEntry(equalTo("key2"), equalTo("value2")))),
toPackage("com.android.browser")));
Run Code Online (Sandbox Code Playgroud)
但这给了我错误提示:
这就是这里的例子。这怎么了