我使用线性布局来显示非常轻的初始屏幕.它有一个按钮,应该在屏幕中水平和垂直居中.但无论我尝试做什么,按钮都会在顶部对齐中心.我已经包含了下面的XML,有人能指出我正确的方向吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageButton android:id="@+id/btnFindMe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/findme"></ImageButton>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我们正在使用TFS内部的新VSO/VSTS样式构建,截至昨天的2015 Update 1.
在发布构建工件阶段,我们希望从根条2子文件夹中复制所有文件/文件夹.
即:
$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...
Run Code Online (Sandbox Code Playgroud)
目前我有**\*内容参数,显然会发布一切.我尝试;-:<exclude_pattern>按照谷歌搜索的建议添加,但刚停止所有输出并导致一个空文件夹.
有没有办法使用minimatch表达式来排除文件夹,或者我需要交换显式选择要发布的文件夹.
?:在.net中是否有等效的运算符?例如在java中我可以这样做:
retParts[0] = (emailParts.length > 0) ? emailParts[0] : "";
Run Code Online (Sandbox Code Playgroud)
而不是
if (emailParts.length > 0) {
retParts[0] = emailParts[0];
} else {
retParts[0] = "";
}
Run Code Online (Sandbox Code Playgroud)
我希望能够在VB.NET中做类似的事情.
我目前正在从VB转换到C#,并且在注册我对事件的兴趣方面存在一些问题.
使用VB时,只是指定一个方法Handles和事件,通常是使用对象事件列表生成的.虽然我可以轻松地使用Class.event += delegatein C#,但我不确定最好的位置是放置代码来执行此操作.
我是否最好将其置于InitializeComponent()生成的代码中(例如,如果您从设计器中选择事件)或者我应该将其放在构造函数中以获得更好的可读性/维护.如果在构造函数内部,应该在调用之前还是之后InitializeComponent()?
我正在为我的应用程序创建一个新的设置屏幕,并希望保持与标准应用程序类似的外观和感觉.我见过许多第三方应用程序也遵循这种风格(例如Twidroid),并且想知道如何最好地创建这种外观?
是否有"模板"或我可以使用的活动,还是从表格布局或类似物构建它?
谢谢.
我正在实现一个自定义对话框,以形成一个简单的外观和感觉的屏幕(一旦我开始工作,它可能会变得更加复杂).我有一个xml布局,从R加载一些文本和一个图标.然而,当调用showDialog(int)时,我得到一个力关闭.
我按照开发指南按照说明操作:http://developer.android.com/intl/de/guide/topics/ui/dialogs.html
代码如下:
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch(id) {
case DIAG_ABOUT:
dialog = new Dialog(getApplicationContext());
dialog.setContentView(R.layout.aboutdialog);
dialog.setTitle(R.string.about_title);
dialog.setOwnerActivity(this);
break;
default:
dialog = null;
}
return dialog;
}
Run Code Online (Sandbox Code Playgroud)
DIAG_ABOUT定义为 private static final int DIAG_ABOUT = 0;
Log cat显示以下跟踪:
03-04 11:37:08.760: ERROR/AndroidRuntime(726): Uncaught handler: thread main exiting due to uncaught exception
03-04 11:37:08.780: ERROR/AndroidRuntime(726): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-04 11:37:08.780: ERROR/AndroidRuntime(726): at android.view.ViewRoot.setView(ViewRoot.java:429)
03-04 11:37:08.780: ERROR/AndroidRuntime(726): …Run Code Online (Sandbox Code Playgroud) 我有一个问题FxCop和警告:Abstract types should not have constructors.
这是为许多抽象类显示的(可能所有,我还没有检查过).当我看起来他们中的大多数没有新的方法所以我认为它是编译器添加默认方法.所以要删除它我添加一个私有默认Private Sub New()的constuctor (),这意味着所有的inherting类都无法构建错误:
Class 'InheritingClass' has no accessible 'Sub New' and cannot be inherited.
这似乎很奇怪,因为FxCop请求没有公共构造函数,但是当我删除它时,构建失败.