我有一个以前在Windows 8.1上使用VS 2013构建的WinJS项目.
最近我通过创建一个空白的Javascript Universal windows 10项目将该项目升级到Universal Windows 10,然后从旧项目添加了我的所有文件.
我有Windows运行时组件以及SQLite的类库.
我添加了通用Windows运行时组件和通用类库,并将我的所有文件从旧项目复制到各自的位置.
不知何故,我设法删除所有构建错误.
我安装了所有必需的SQLite-net,SQLite for Universal Windows Platform,Newtonsoft等.
但是当我运行应用程序并在Windows运行时组件中调用Native方法时,它会产生一些奇怪的错误:
An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll but was not handled in user code.
Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Newtonsoft版本是:9.0.1
我的Windows运行时组件的project.json文件如下:
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {}, …Run Code Online (Sandbox Code Playgroud) c# visual-studio win-universal-app windows-10 windows-10-universal
当用户使用以下代码片段点击通知(在操作栏上)时,我正在Windows Phone 8.1应用程序(使用HTML/JS,CSS)上处理Toast Notifications:参考:https://msdn.microsoft.com/en-us /library/windows/apps/hh761468.aspx
WinJS.Application.addEventListener("activated", onActivatedHandler, false);
function onActivatedHandler(args) {
if (args.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
localStorage.messageDetails = args.detail.arguments;
window.location.href = "index.html";
}
}
Run Code Online (Sandbox Code Playgroud)
当应用程序在前台或后台运行时,它运行良好.但是,当我点击通知时,它没有在应用程序未运行时(前景或后台)点击上面的代码段.我不知道我做错了什么.请帮帮我.提前致谢.
javascript windows cordova windows-phone-8 windows-phone-8.1
在 App.xaml 中,我添加了带有按钮的应用程序资源:
<Application.Resources>
<Button x:Key="MyButton"/>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
在 中MainPage.xaml.cs,我尝试以编程方式在我的网格中添加此按钮。
Button btn = (Button)Application.Current.Resources["MyButton"];
myGrid.Children.Add(btn);
Run Code Online (Sandbox Code Playgroud)
但它给出了这样的错误:
No installed components were detected. Element is already the child of another element.
在 MainPage.xaml 中:
<Grid x:Name="myGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Grid>
Run Code Online (Sandbox Code Playgroud)
我不知道我做错了什么。
谢谢。
我ColumnDefinitions在XAML中设置如下:
<Grid x:Name="MainGrid" Background="#FF256BD1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
...
</Grid>
Run Code Online (Sandbox Code Playgroud)
在后面的代码我添加了一个StackPanel像孩子MainGrid一样:
MainGrid.Children.Add(stackPanel);
Run Code Online (Sandbox Code Playgroud)
如何把这个StackPanel中在代码的第一列后面就像我们在XAML做的:Grid.Column="0"或Grid.ColumnSpan="2"或Grid.Row="1"等
我正在努力制作一个很酷的布局,如下所示:
为此,我正在使用Github的 Android Parallax库。该库从xml本身创建所有视图(如图所示)。但是我想创建自己的recyclerview,创建adpater,模型类并使用cardview显示它们。
我尝试使用cardview和recyclerview。
问题:
当我将RecyclerView的高度设置为match_parent(android:layout_height =“ match_parent”)时,它给出如下的UI:
仅显示第一张卡片视图,仅显示一半。其他卡片视图以某种方式重叠。
但是,当我使用固定高度(例如1000dp,2000dp)给出其高度时,它会按预期显示UI(如第一个图所示)。我认为将其高度固定是一个不好的解决方案,因为数据项可能会有所不同。
我不明白我的代码有什么问题。请为此提出一些解决方案。
以下是我对代码的不同看法。
activity_main.xml
<com.github.florent37.parallax.ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="@drawable/background"
android:tag="parallax=0.3" />
<TextView
style="@style/MyTitle"
android:layout_width="match_parent"
android:layout_height="160dp"
android:gravity="center"
android:tag="parallax=0.5"
android:text="My awesome title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="150dp"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
</FrameLayout>
</com.github.florent37.parallax.ScrollView>
Run Code Online (Sandbox Code Playgroud)
card_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="center"
android:layout_margin="5dp"
card_view:cardCornerRadius="2dp"
card_view:contentPadding="10dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView …Run Code Online (Sandbox Code Playgroud) 我有两个数组:
int[] oddArr = { 11, 9, ... };
int[] evenArr = {4, 2, 8, ... };
我要检查,如果从每一个项目oddArr比从每一个项目更大evenArr那么,我们应该做一些逻辑.
喜欢:
if(11 > 4 && 11 > 2 && 11 > 8 && 9 > 4 && 9 > 2 && 9 > 8 && ...)
我试过这样的事情:
for (int i = 0; i < oddArr.Length; i++)
{
for (int j = 0; j < evenArr.Length; j++)
{
if (oddArr[i] > evenArr[j])
{
}
}
}
Run Code Online (Sandbox Code Playgroud) c# ×4
windows ×3
windows-8.1 ×2
xaml ×2
android ×1
android-xml ×1
arrays ×1
cordova ×1
if-statement ×1
java ×1
javascript ×1
windows-10 ×1
xml ×1