我创建了自己的UserControl"ClockControl",我通过主窗口的XAML初始化.
唯一的问题是我必须将一个参数传递给时钟控件的构造函数,我不知道我该如何做到这一点.
如果我没有参数,这可以工作:
<myControl:ClockControl></myControl:ClockControl>
Run Code Online (Sandbox Code Playgroud)
但是我如何传递参数呢?
这是构造函数:
public ClockControl(String city)
{
InitializeComponent();
this.initController();
......
.....
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我将在我的应用程序中显示pdf,并且pdf必须与应用程序捆绑在一起.
有什么好办法呢?
我已经读过,可以通过将pdf文件添加到res/raw文件夹并从那里读取它来实现这一点,但是当我将pdf文件放在那里时我得到了项目错误.
所以我试着把pdf文件放在项目的资产文件夹中,它没有给出任何错误.
这是我试图显示pdf的方式:
File pdfFile = new File("res/raw/file.pdf");
Uri path = Uri.fromFile(pdfFile);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Run Code Online (Sandbox Code Playgroud)
任何想法或建议?
提前致谢
我实现了一个使用JavascriptInterface的Webview.它没有混淆时工作正常,但Proguard立即活跃,它不起作用.我在这里看了其他答案,但我还是无法让它发挥作用.
一些WebView类:
public class Activity_Webview {
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new JavaScriptInterface (), "HTMLOUT");
webView.setWebViewClient(mWebViewClient);
}
public class JavaScriptInterface implements NonObfuscateable{
@JavascriptInterface
public void processHTML(String html) {
handleFinishFromWebView(html);
}
}
Run Code Online (Sandbox Code Playgroud)
我在Proguard尝试过的:
-keep public class * implements com.project.NonObfuscateable
-keepclassmembers class * implements NonObfuscateable {
public void processHTML(java.lang.String);
}
Run Code Online (Sandbox Code Playgroud)
我也试过这个(当没有实现NonObfuscateable接口时:
-keep public class com.project.Activity_Webview.JavaScriptInterface
-keep public class * implements com.project.Activity_Webview.JavaScriptInterface
-keepclassmembers class * implements com.project.Activity_Webview.JavaScriptInterface {
<fields>;
<methods>;
}
Run Code Online (Sandbox Code Playgroud)
有人知道可能出现什么问题吗?提前致谢
我有一份报告,我也有附录.我想要的是在附录开始时在页面编号上使用不同的样式.
我使用阿拉伯语直到我到达附录.然后我想做这样的事情:
我希望自定义页面编号为:
Chapter: A
Section: {Chapter}{1} (A-1)
Run Code Online (Sandbox Code Playgroud)
\newpage
\pagenumbering{custompagenumbering}
Run Code Online (Sandbox Code Playgroud)
这可能吗?
我需要能够在我的应用程序中选择日期和时间它应该通过使用对话框或启动新的意图来完成.
我现在的方式是,我已经开始了新的意图,因为我需要设置日期和时间.
我的问题是我需要在onCreate 上设置当前日期Datepicker(这可以Timepicker使用setCurrentHour和setCurrentMinute),并将其设置为下边界.
我在Android API中找不到任何用于执行此操作的函数DatePicker.
有人有建议解决这个问题吗?
提前致谢!
编辑:重要:DatePicker和,TimePicker必须在相同的对话框/意图中
我正在使用Qt Nokia SDK进行开发.
在尝试在函数中显示消息框时,我无法显示MessageBox的按钮.如果我尝试在主窗口中显示它,显示按钮没有问题.
主窗口包含一个包含不同小部件的QStackWidget.
这是在主窗口中工作的代码:
QMessageBox msgBox;
msgBox.setText("Name");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard |
QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();
Run Code Online (Sandbox Code Playgroud)
这是我在收到来自Web请求的响应后运行的函数和代码(消息框显示,但不显示按钮.
void MainWindow::RequestReceived()
{
QMessageBox *msgBox = new QMessageBox(this);
msgBox->setText("Test");
msgBox->setWindowModality(Qt::NonModal);
msgBox->setInformativeText("Do you want to save your changes?");
msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard |
QMessageBox::Cancel);
msgBox->setDefaultButton(QMessageBox::Save);
int ret = msgBox->exec();
}
Run Code Online (Sandbox Code Playgroud)
任何人都知道发生了什么?
提前致谢!
我收到这条消息:
javax.xml.parsers.FactoryConfigurationError:提供程序org.apache.xerces.jaxp.DocumentBuilderFactoryImp
但我似乎无法解决问题。我用谷歌搜索过,但找不到任何好的解决方案。
有谁知道可能出了什么问题吗?也许如何解决它:)
我有一个面板,里面有许多图片盒.每个图片框都注册了"contextRightMenu"作为其上下文菜单.
弹出上下文菜单时我想要的是获取当前的鼠标位置.
我尝试使用mouseDown并单击来获取鼠标位置,但这些事件发生在单击上下文菜单的其中一个项目之后,这为时已晚.
上下文菜单的弹出事件不会传递鼠标事件参数,因此我不知道如何获取鼠标位置.
如果我能得到鼠标事件args很容易.
那我就可以:
this.contextRightClick.Popup += new System.EventHandler(this.contextRightClick_Popup);
// If EventArgs include mouseposition within the sender
private void contextRightClick_Popup)(object sender, EventArgs e)
{
int iLocationX = sender.Location.X;
int iLocationY = sender.Location.Y;
Point pPosition = new Point(iLocationX + e.X, iLocationY + e.Y); // Location + position within the sender = current mouseposition
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我获得一些鼠标事件args,或建议一个事件将在contextmenu弹出窗口之前运行?
提前致谢
我似乎无法在Eclipse文档中找到此符号,并且我不是使用Eclipse的专家.
任何人都可以向我解释这意味着什么?
符号: Eclipse符号http://img85.imageshack.us/img85/4489/eclipsesymbol.png
这是困扰我的箭头.它可以是共享资源吗?
提前致谢!
我有一个JSONObject:
{user:{"firstname":"testuser","surname":"æøå"}}
Run Code Online (Sandbox Code Playgroud)
所以我在对象中有这些特殊字符
我URLncode我有的jsonString.
urlEncodedJsonReq = URLEncoder.encode("{user:{\"firstname\":\"testuser\",\"surname\":\"æøå\"}}","UTF-8");
Run Code Online (Sandbox Code Playgroud)
我收到服务器的回复:"你提交的URI不允许使用字符." 这是编码的网址:serverurl/%7Buser%3A%7B%22firstname%22%3A%22testuser%22%2C%22surname%22%3A%22%C3%A6%C3%B8%C3%A5%22%7D%7D
但我需要的是:
%7Buser:%7B%22firstname%22:%22testuser%22%2C%22surname%22:%22%C3%A6%C3%B8%C3%A5%22%7D%7D
Run Code Online (Sandbox Code Playgroud)
这有可能以任何合理的方式吗?
提前致谢