我有一个带有自定义toolbar和持久性的应用程序布局BottomSheet- 两者都在内部CoordinatorLayout.
在按钮上单击我想显示BottomSheet.现在,工作表全屏显示并覆盖toolbar.由APP主题设置Theme.AppCompat.Light.DarkActionBar在BottomSheet下方的停留ActionBar,但不能自定义吧.
有没有办法将persitent的高度限制BottomSheet为全屏 - ActionBar高度?
这是我的代码 activity_main.xml
<android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.test.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
app:elevation="20dp"
android:elevation="20dp"
android:layout_height="?attr/actionBarSize">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:elevation="20dp"
android:elevation="20dp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
</LinearLayout>
<include layout="@layout/bottom_sheet_additem"/>
</CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
这是代码 sheet_bottom.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottomSheetLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
android:fitsSystemWindows="true"
app:layout_behavior="@string/bottom_sheet_behavior">
<TextView
android:id="@+id/bottomsheet_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Lorem Ipsum Dolor..."
android:textColor="#FFFFFF" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我目前正在使用中的闭包和链接完成Swift。我非常熟悉and 的C#风格,因此我想知道如何将以下代码段从翻译为。asyncawaitC#Swift
public async Task SomeFunction(string inputString)
{
var first = await GetFirstVariableAsync(inputString);
var second = await GetSecondVariableAsync(first);
if (second == "some condition")
{
first = await GetFirstVariableAsync(inputString);
var second = await GetSecondVariableAsync(first);
}
}
Run Code Online (Sandbox Code Playgroud)
是否Swift具有类似的构造,例如await,以等待函数完成而不必嵌套多个完成块?
谢谢
我正在构建一个支持两种语言(en和de)的UWP应用程序.我创建了两个Resource.resw文件和一个testfile.xml基本上是我的应用程序的数据源.如果我直接从Visual Studio(运行应用程序DEBUG或RELEASE模式),它的正常工作,但一旦我从商店安装它或将它侧向载荷的设备通过WinAppDeployCmd.exe它不会加载从资源Resources.resw
这是我在Strings目录中的文件结构:
我有链接到Resources.resw文件中指定的testfile,如下所示:

启动应用程序后,我使用a ResourceLoader来检索Testfile密钥的值以加载正确(en或de)文件.
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
var value = loader.GetString("Testfile");
var testfile = Path.Combine(Package.Current.InstalledLocation.Path + "/Strings/", value);
Run Code Online (Sandbox Code Playgroud)
在构建过程中,这些警告会显示在输出窗口中
MakePRI : warning 0xdef01051: No default or neutral resource given for 'Files/Project/Strings/testfile_de.xml'. The application may throw an exception for certain user configurations when retrieving the resources.
MakePRI : warning 0xdef00522: Resources found for language(s) 'en,de' but no resources found for default …Run Code Online (Sandbox Code Playgroud) 我已经在Python(带有dlib和OpenCV)中创建了一个图像处理脚本-我想知道如何将该功能引入Azure Functions,以便可以通过API调用该脚本。正如Python仍在预览中一样,Azure Functions我想知道这里是否有人有将模块引入的经验,Azure Functions以及是否可以在OpenCV那里安装?
我Azure Notification Hub用来向多个移动平台发送推送通知.
通过注册Mobile Service我为推送通知指定了几个标签Notification Hub.我的问题是如何查看已注册的所有注册和所有标签?
我在管理门户或Visual Studio中找不到任何内容.是否有可用于显示所有注册的工具Notification Hub?
azure push-notification apple-push-notifications azure-mobile-services azure-notificationhub
我有一个 UICollectionView,它使用 NSFetchedResultsController 显示来自 CoreData 的实体。正如您在屏幕截图中看到的,用户可以选择多个标有边框的单元格。
我的模型基本上只有一个字符串和一个布尔值,用于通过 UICollectionView 处理选择。
var url: String
var selected: Bool
var section:Section
Run Code Online (Sandbox Code Playgroud)
我已经实施了func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)为了支持重新排序UICollectionViewCells。拖放操作工作正常,但我很难将移动的项目保存到 CoreData。我必须position向我的模型添加属性吗?
func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
var sourceArray = self.fetchedResultController.fetchedObjects
let item = sourceArray?.remove(at: sourceIndexPath.item)
sourceArray?.insert(item!, at: destinationIndexPath.row)
coreData.saveContext()
}
Run Code Online (Sandbox Code Playgroud)
我尝试fetchedResultsController.fechtedObjects直接修改,但这不起作用,因为该属性是只读的。使用 和 进行拖放的最佳方法是UICollectionView什么NSFetchedResultsController?
编辑:
初始排序UICollectionView基于Section模型中的索引属性。目前,各部分只有此排序键,部分内的项目没有任何排序键。
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "section.index", ascending: false)] …Run Code Online (Sandbox Code Playgroud) core-data nsfetchedresultscontroller ios uicollectionview swift
我尝试使用构建以下UI元素Xamarin.Forms.我能有建立这个UWP由绑定Height的属性TopGrid的ActualWidth财产Button1.但是这在Xamarin.Forms中不起作用,因为没有ActualWidth属性.我已经尝试过绑定Height的TopGrid到WidthRequest,但没有成功.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="TopGrid" Grid.Row="0" BindingContext="{x:Reference Name=Button1}" Height="{Binding Path=WidthRequest}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="Button1" Grid.Column="0" Text="1" />
<Button x:Name="Button2" Grid.Column="1" Text="2" />
<Button x:Name="Button3" Grid.Column="2" Text="3" />
<Button x:Name="Button4" Grid.Column="3" Text="4" />
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)
有没有人有经验,Xamarin.Forms可以帮我解决这个问题?
我正在做一些简单的加密/解密编码,但遇到了一个我自己无法解决的问题。
我有一个十六进制编码的密文。密文为AES,块长128bits,密钥长度256bits。密码块模式为CBC。IV 是密文的第一个块。
异常消息是非法密钥大小。
这是我的解密()函数:
public static byte[] decrypt() throws Exception
{
try{
byte[] ciphertextBytes = convertToBytes("cb12f5ca1bae224ad44fdff6e66f9a53e25f1000183ba5568958430c11c6eafc62c04de8bf27e0ac7104b598fb492142");
byte[] keyBytes = convertToBytes("CFDC65CB003DD50FF5D6D826D62CF9CA6C64489D60CB02D18C1B58C636F8220D");
byte[] ivBytes = convertToBytes("cb12f5ca1bae224a");
SecretKey aesKey = new SecretKeySpec(keyBytes, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, aesKey, new IvParameterSpec(ivBytes));
byte[] result = cipher.doFinal(ciphertextBytes);
return result;
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
我有这些函数来做转换 String/ByteArray
//convert ByteArray to Hex String
public static String convertToHex(byte[] byteArray)
{
StringBuilder sb = new StringBuilder();
for (byte b : byteArray)
{
sb.append(String.format("%02X", b)); …Run Code Online (Sandbox Code Playgroud) 我在 Windows 上的 MySQL 设置有问题。首先,我从 dev.mysql.com 下载了最新的 Windows Installer 并安装了服务器。现在,当我尝试在 cmd 中执行 MySQL 命令时(我已经修改了 PATH 变量,并且我以 MySQL root 用户身份登录)该命令不会被执行,只会显示一个“->”。
我只能通过输入“\q”来退出这个“模式”,而不是通过执行“exit”。
也许你可以帮助我,我的 Ruby on Rails 项目真的需要 MySQL。
谢谢!
azure ×2
c# ×2
swift ×2
xaml ×2
aes ×1
android ×1
async-await ×1
asynchronous ×1
bottom-sheet ×1
cbc-mode ×1
closures ×1
command-line ×1
core-data ×1
data-binding ×1
encryption ×1
ios ×1
java ×1
localization ×1
mysql ×1
opencv ×1
python ×1
windows ×1
wpf ×1