小编Con*_*rad的帖子

如何在Android Dialog内部布局?

我正在尝试创建一个自定义对话框,并将其内容置于中心位置,但它始终以左对齐方式结束.这是aboutdialog.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:a="http://schemas.android.com/apk/res/android"
  a:orientation="vertical"
  a:id="@+id/AboutDialogLayout" 
  a:layout_width="fill_parent" 
  a:layout_height="fill_parent" 
  a:layout_gravity="center_horizontal" 
  a:gravity="center_horizontal">

    <ImageView a:id="@+id/imageView1" 
               a:src="@drawable/pricebook" 
               a:layout_height="wrap_content" 
               a:layout_width="wrap_content"/>
    <TextView a:layout_height="wrap_content"         
              a:textAppearance="?android:attr/textAppearanceLarge" 
              a:id="@+id/textView1" 
              a:text="Price Book" 
              a:layout_width="wrap_content"/>
    <TextView a:layout_height="wrap_content" 
              a:id="@+id/textView2" 
              a:layout_width="wrap_content" 
              a:text="foo"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的(相关)代码:

Dialog d = new Dialog(this);
d.setContentView(R.layout.aboutdialog);
d.setTitle(R.string.app_name);
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?谢谢你的帮助.

图片: 对话框问题的屏幕截图

android dialog android-layout customdialog

12
推荐指数
1
解决办法
8223
查看次数

如何在WPF工具包日历控件中绑定BlackoutDates?

我想将一个日期列表绑定到BlackoutDates属性,但它似乎不太可能.特别是在MVVM场景中.有没有人做过这样的事情?是否有任何好的日历控件可以与MVVM配合使用?

c# data-binding wpf calendar mvvm

11
推荐指数
3
解决办法
8848
查看次数

Android手册X509证书链验证

我已经javax.net.ssl.X509TrustManager在我的代码中实现了所以我可以验证我的软件访问的自签名证书.但是,我仍然需要验证其他一些"标准"网站SSL证书.我正在使用CertPathValidator.validate()这个,但我刚刚意识到我传递的一个证书链(对于maps.googleapis.com)实际上并不包含完整的链 - 它包含整个链但是根CA(Equifax),在手机上确实存在,但validate()仍然失败,因为(显然)它没有明确地在链中.我在这里缺少什么,以便验证成功?感谢您的任何意见.

编辑 - 相关代码(删除了异常检查):

CertificateFactory cf = CertificateFactory.getInstance("X.509");
// chain is of type X509Certificate[]
CertPath cp = cf.generateCertPath(Arrays.asList(chain));

CertPathValidator cpv = CertPathValidator.getInstance(CertPathValidator.getDefaultType());
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());

FileInputStream is = new FileInputStream("/system/etc/security/cacerts.bks");
ks.load(is, null);

PKIXParameters params = new PKIXParameters(ks);
CertPathValidatorResult cpvr = cpv.validate(cp, params);
Run Code Online (Sandbox Code Playgroud)

validation ssl android ssl-certificate x509certificate

5
推荐指数
1
解决办法
6368
查看次数

是否有ServiceBase.ExitCode值的通常含义的列表?

在的文档中ServiceBase.ExitCode,它只是说应将其设置为“在停止服务以指示错误之前...为非零值”。此数字是特定于应用程序的还是标准错误代码及其含义的列表?某处?

.net service windows-services exit-code

5
推荐指数
0
解决办法
715
查看次数

AnkhSVN在Visual Studio 2017中崩溃

[W10 Pro x64 v1709,Visual Studio 2017社区15.6.0,AnkhSVN 2.7.12815.35086]

我在VS 2017的VS初创公司AnkhSVN遇到了崩溃.我相信这才刚刚开始发生 - 我不记得最后一次打开IDE时发生了什么.卸载/重新安装扩展程序没有帮助.尝试打开Pending Changes窗口时出现错误消息:

AnkhSVN异常
发生内部错误:
对象引用未设置为对象的实例.

堆栈跟踪:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Ankh.UI.PendingChanges.PendingChangesToolControl.OnLoad(EventArgs e)
   at System.Windows.Forms.UserControl.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at Ankh.VSPackage.AnkhToolWindowPane.get_Window()
   at Microsoft.VisualStudio.Shell.Package.ToolWindowCreationResult..ctor(WindowPane window, UInt32 flags)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags, Object context, Guid persistenceGuid)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, Object context)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id)
   at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)
   at Ankh.VSPackage.AnkhSvnPackage.ShowToolWindow(AnkhToolWindow toolWindow, Int32 …
Run Code Online (Sandbox Code Playgroud)

ankhsvn exception visual-studio-2017

5
推荐指数
1
解决办法
1677
查看次数

Visual Studio C++ 中的 msmpi.dll 错误消息

我正在研究 mpi,但我一直收到此错误消息:

(程序无法启动,因为您的计算机缺少 msmpi.dll 请尝试重新安装程序来解决此问题)

所以我的问题是:

卸载Visual Studio并重新安装可以解决这个问题吗?或者我应该使用电脑修复工具包程序和注册表修复程序来解决问题?

还有什么解决办法呢?

c++ mpi

4
推荐指数
1
解决办法
1万
查看次数

无法在R/RStudio中安装XML包

[环境:macOS 10.12.6,RStudio 1.1.383,R 3.4.2(通过自制软件)]

请注意,这不是这个问题的重复- 那里的解决方案对我不起作用.

当我尝试在RStudio中安装XML包时,我收到安装错误:

> install.packages("XML")
Installing package into ‘/usr/local/lib/R/3.4/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/XML_3.98-1.9.tar.gz'
Content type 'application/x-gzip' length 1599437 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix …
Run Code Online (Sandbox Code Playgroud)

xml homebrew r libxml2 rstudio

3
推荐指数
1
解决办法
2883
查看次数

如何将WPF按钮的内容设置为多种颜色?

我希望Content我的WPF Button使用多种颜色,例如:

<Button Name="MyButton">
    <Blue>This is</Blue
    <Red>Red</Red>
</Button>
Run Code Online (Sandbox Code Playgroud)

我看到我不能使用多个Runs TextBlock- 实现这种效果的正确方法是什么?

wpf xaml colors button wpf-controls

2
推荐指数
1
解决办法
940
查看次数

如何测试X509TrustManager子类?

我进行了子类化,javax.net.ssl.X509TrustManager因此我可以使用私有SSL证书.现在我正在尝试为我的类编写一个JUnit测试,但测试用例一直给我一个空指针异常.

例如,我的实现checkClientTrusted()是一个空方法.但是,当我使用(假设的)有效实例X509Certificate[](以及任何类型的String )调用该方法时,JUnit会报告NullException该行的测试代码.关于我缺少什么的任何建议?

java ssl junit cryptography x509certificate

1
推荐指数
1
解决办法
1448
查看次数

如何在SQL中创建今天晚上9点的时间

我想smalldatetime在查询中获得"今天晚上9点" 的值.我以为我可以用

DATEADD(HOUR, 21, CONVERT(date, GETDATE()))
Run Code Online (Sandbox Code Playgroud)

但SQL Server不喜欢这样 - 我收到了错误

数据类型日期的日期函数dateadd不支持datepart小时.

建议解决方法?

sql t-sql sql-server sql-server-2008

0
推荐指数
1
解决办法
194
查看次数