我尝试用推荐的技术产生这种效果,但我明白了:
从屏幕截图中可以清楚地看到,我的应用内容都没有被绘制在状态栏后面.
有趣的是,不知何故,Nav Drawer设法在状态栏后面绘制:
我做的东西:
CoordinatorLayout,,AppBarLayoutToolbarDrawerLayoutwindowTranslucentStatus设置为true我的应用主题fitsSystemWindows设置为true我的CoordinatorLayout这是我的应用主题:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这是我的活动布局:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<FrameLayout android:id="@+id/page_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"/>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
我的活动布局中的FrameLayout被替换为此片段布局:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" …Run Code Online (Sandbox Code Playgroud) android statusbar android-support-library material-design android-coordinatorlayout
我正在尝试使用本机Windows消息队列系统(没有.NET)使用C/C++创建一个简单的窗口.我按照MSDN教程编写了一些创建空窗口的基本代码:
void main()
{
HINSTANCE hinst;
HWND hwndMain;
WNDCLASSEX wnd;
MSG msg;
hinst = GetModuleHandle( NULL );
memset( &wnd, 0, sizeof( wnd ) );
wnd.cbSize = sizeof( wnd );
wnd.lpszClassName = "MainWClass";
wnd.lpfnWndProc = MainWProc;
wnd.hInstance = hinst;
int result = RegisterClassEx( &wnd );
if( !result )
{
printf("RegisterClassEx error: %d\r\n", GetLastError() );
}
hwndMain = CreateWindowEx
(
0, //extended styles
wnd.lpszClassName, //class name
"Main Window", //window name
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL | WS_MINIMIZEBOX, //style tags
CW_USEDEFAULT, //horizontal position …Run Code Online (Sandbox Code Playgroud) 该的NodeJS文档强调,binary字符串编码在很大程度上气馁,因为它会在未来的某个时刻被丢弃.
但是,我正在尝试使用node-imagemagick模块生成图像缩略图,该模块只能输出binary编码的字符串.
我的最终目标是将生成的缩略图作为BLOB提交到SQLite3数据库(我正在使用node-sqlite3),所以我想我需要将缩略图作为二进制缓冲区对象.
如何将binary编码输出直接解码node-imagemagick为原始二进制缓冲区(而不仅仅是包含binary编码字符串的缓冲区)?我不喜欢用base64...
我有ListFragment一个简单的联系ArrayAdapter.ListView包含可检查项的列表,其XML布局如下:
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_marginLeft="2mm"
android:layout_marginRight="2mm"
android:drawSelectorOnTop="false"
android:longClickable="true"
android:choiceMode="multipleChoiceModal"/>
Run Code Online (Sandbox Code Playgroud)
如您所见,我在XML布局中设置了long-clickable和choicemode属性.
我设置适当的听众中ListFragment的onViewCreated回调:
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ListView list_view = getListView();
list_view.setMultiChoiceModeListener(this);
list_view.setOnItemLongClickListener(this);
}
Run Code Online (Sandbox Code Playgroud)
我this作为listener参数传入,因为我ListFragment还实现了那些侦听器的回调.
这是我遇到问题的回调:
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id
{
activity.startActionMode(this);
return true;
}
Run Code Online (Sandbox Code Playgroud)
首先,onItemLongClick从未调用过.但是,当长按一个列表项时,Contextual Action Bar(CAB)会启动并完美运行!
事实上,如果没有这个回调,CAB会正确启动!我的回调使用activity.startActionMode(this),它会显示CAB,但不便于检查列表中的项目(我在别处测试过).
如何以编程方式正确处理长按以启动CAB并便于检查列表项?
我正在使用Android开发人员指南主题中提供的方法(他们使用onLongClickListener,我也尝试无效),但它似乎没有用.
android android-listview onlongclicklistener android-listfragment contextual-action-bar
当CreateWindowEx()在我的程序中失败时,我收到错误ERROR_INVALID_WINDOW_HANDLE.我正在使用C++与本机Win32 API.
我不知道为什么,我已经尝试在CreateWindowEx中使用一些参数,但每次都会产生完全相同的错误.
我还尝试添加W随机函数和数据类型,希望UNICODE版本以某种方式工作......当然没有任何改变.
这是调用CreateWindowEx()的函数:
int InitMainWindow( HWND *hwnd, WNDCLASSEXW *wnd, WNDPROC wndproc )
{
memset( wnd, NULL, sizeof( WNDCLASSEXW ) );
wnd->cbSize = sizeof( WNDCLASSEXW );
wnd->lpszClassName = L"MainWClass";
wnd->lpfnWndProc = wndproc;
wnd->hInstance = GetModuleHandle( NULL );
if( NULL == RegisterClassExW(wnd) )
{
printf( "InitMainWindow::RegisterClassexW() error: %d\r\n", GetLastError() );
return GetLastError();
}
*hwnd = CreateWindowExW
(
WS_EX_ACCEPTFILES | WS_EX_APPWINDOW, //extended styles
wnd->lpszClassName, //class name
L"MainWindow", //window name
WS_OVERLAPPEDWINDOW | WS_VISIBLE, //style tags
CW_USEDEFAULT, //horizontal position
CW_USEDEFAULT, //vertical …Run Code Online (Sandbox Code Playgroud) 我crypto在服务器端使用NodeJS的捆绑模块进行SHA256散列.在客户端,我使用的是一个名为的JavaScript库Crypto-JS.
我使用SHA256哈希用于使用经典的基于随机数的身份验证的登录系统.但是,即使哈希消息相同,我的服务器端和客户端哈希摘要也不匹配(我已经检查了这一点).甚至散列摘要的长度也不同.
这是我的客户端实现的片段:
var password_hash = CryptoJS.SHA256( token.nonce /*this is the server's nonce*/ + cnonce + password ).toString(CryptoJS.enc.Base64);
Run Code Online (Sandbox Code Playgroud)
这是我的服务器端实现的片段:
var sha256 = CRYPTO.createHash("sha256");
sha256.update(snonce+cnonce+password, "utf-8");
var hash = sha256.digest("base64");
Run Code Online (Sandbox Code Playgroud)
这是一些示例数据:
client-digest: d30ab96e65d09543d7b97d7cad6b6cf65f852f5dd62c256595a7540c3597eec4
server-digest: vZaCi0mCDufqFUwVO40CtKIW7GS4h+XUhTUWxVhu0HQ=
client-message: O1xxQAi2Y7RVHCgXoX8+AmWlftjSfsrA/yFxMaGCi38ZPWbUZBhkVDc5eadCHszzbcOdgdEZ6be+AZBsWst+Zw==b3f23812448e7e8876e35a291d633861713321fe15b18c71f0d54abb899005c9princeofnigeria
server-message: O1xxQAi2Y7RVHCgXoX8+AmWlftjSfsrA/yFxMaGCi38ZPWbUZBhkVDc5eadCHszzbcOdgdEZ6be+AZBsWst+Zw==b3f23812448e7e8876e35a291d633861713321fe15b18c71f0d54abb899005c9princeofnigeria
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么哈希不同?我认为如果它是相同的协议/算法,它将始终产生相同的哈希.
编辑:哇.我去了这个在线哈希工具,它为同一个消息产生了另一个摘要:
4509a6d5028b217585adf41e7d49f0e7c1629c59c29ce98ef7fbb96c6f27502c
Run Code Online (Sandbox Code Playgroud)
编辑编辑:第二个想法,在线哈希工具不同的原因可能是因为它使用了hex我使用的编码base64
我想和一个朋友开始一个开源项目,我们正在讨论开源许可证,但我们都没有真正理解许可证的模糊和不明确的条款和条件。
我们很好:
但不想:
你们能推荐任何满足这些标准的开源许可证吗?
我正在尝试制作一个只有上下文菜单作为 GUI 的小型系统托盘程序。
但是,我无法使工具提示起作用。我正确设置了 NOTIFYICONDATA 的 szTip,其他一切似乎都有效……是什么阻止了工具提示在鼠标悬停时显示?
void main()
{
int result;
hinst = GetModuleHandle( NULL );
memset( &wnd, 0, sizeof( wnd ) );
wnd.cbSize = sizeof( wnd );
wnd.lpszClassName = "MainWClass";
wnd.lpfnWndProc = MainWProc;
wnd.hInstance = hinst;
result = RegisterClassEx( &wnd );
hwnd = CreateWindowEx
(
0, //extended styles
wnd.lpszClassName, //class name
"Main Window", //window name
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL | WS_MINIMIZEBOX, //style tags
CW_USEDEFAULT, //horizontal position
CW_USEDEFAULT, //vertical position
CW_USEDEFAULT, //width
CW_USEDEFAULT, //height
(HWND) NULL, //parent window …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用Visual Studio 2010的对话框编辑器,我注意到的第一件事是我可以添加的控件都是Windows 95风格而不是Window Vista/7 Aero风格.
我怀疑可能只有MFC有Aero风格控件,但我无法测试这个,因为我真的不想使用MFC(这应该是一个超轻量级程序).
有什么我可以用Aero风格控件制作对话框吗?
winapi ×4
c++ ×3
android ×2
node.js ×2
visual-c++ ×2
aero ×1
binary ×1
buffer ×1
c ×1
cryptography ×1
encoding ×1
hash ×1
imagemagick ×1
licensing ×1
open-source ×1
sha ×1
sha256 ×1
statusbar ×1
tooltip ×1
window ×1