我正在玩棒棒糖sceneTransitionAnimations.
为了得到它的工作,你需要实现getWindow().setExitTransition()+ getWindow().setReenterTransition()在调用活动的onCreate,而getWindow().setEnterTransition()+ getWindow().setReenterTransition()在所谓的活动的onCreate.
然后,当你打电话时,startActivity你必须通过呼叫传递Bundle给你获得的那个功能ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle().
这很好用.但是我需要开始一项活动startActivityForResult.这个函数只需要a Intent和a requestCode,但不需要Bundle.将捆绑包放入意图使用putExtras不起作用.
当我想使用时,如何让这些漂亮的Lollipop过渡工作startActivityForResult?
在我被问到代码时编辑:
我在片段中,我有一个项目列表.单击某个项目时,我会启动另一个活动.
Intent intent = new Intent(context, otherActivity.class);
Bunde bundle = null;
if (android.os.Build.VERSION.SDK_INT >= 21)
bundle = ActivityOptions.makeSceneTransitionAnimation(getActivity()).toBundle();
Run Code Online (Sandbox Code Playgroud)
现在这里有两个区别.这个工作:
getActivity().startActivity(intent, bundle);
Run Code Online (Sandbox Code Playgroud)
片段不提供此功能,因此我必须使用其父活动 - 因此getActivity().
这其中并没有工作:
intent.putExtras(bundle);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud) 我正在做一个项目。到目前为止,我一直在使用一个简单的编辑器和我自己的 Makefile 来构建它。不过,我想切换到 CLion。
根据这个问题你可以告诉CMake运行你的Makefile。所以我的CMake.txt看起来像这样:
cmake_minimum_required(VERSION 3.6)
project(rekotrans_testbed_simulator)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_custom_target(rekotrans_testbed_simulator COMMAND make -C ${rekotrans_testbed_simulator_SOURCE_DIR} CLION_EXE_DIR=${PROJECT_BINARY_DIR})
Run Code Online (Sandbox Code Playgroud)
它构建得很好。我还设置了工作目录并指向正确的可执行文件。
在我的项目中我测试使用cppunit 1.13. 但是它找不到共享库:
/home/kunterbunt/dev/comnets/git-repository/rekotrans-testbed-simulator/rekotrans-testbed-simulator-tests: error while loading shared libraries: libcppunit-1.13.so.0: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
LD_LIBRARY_PATH指着
echo $LD_LIBRARY_PATH
/usr/local/lib
Run Code Online (Sandbox Code Playgroud)
并/usr/local/lib包含库:
ls /usr/local/lib/
libcppunit-1.13.so.0@ libcppunit-1.13.so.0.0.2* libcppunit.a libcppunit.la* libcppunit.so@ pkgconfig/
Run Code Online (Sandbox Code Playgroud)
ldd显示这个:
ldd /home/kunterbunt/dev/comnets/git-repository/rekotrans-testbed-simulator/rekotrans-testbed-simulator-tests
linux-vdso.so.1 (0x00007ffc257e8000)
libboost_thread.so.1.63.0 => /usr/lib/libboost_thread.so.1.63.0 (0x00007f1c73254000)
libboost_system.so.1.63.0 => /usr/lib/libboost_system.so.1.63.0 (0x00007f1c73050000)
libboost_date_time.so.1.63.0 => /usr/lib/libboost_date_time.so.1.63.0 (0x00007f1c72e3f000)
libpthread.so.0 => …Run Code Online (Sandbox Code Playgroud) 最小代码示例如下:
#include <cstdlib>
#include <iostream>
#include <vector>
#include <regex.h>
using namespace std;
class regex_result {
public:
/** Contains indices of starting positions of matches.*/
std::vector<int> positions;
/** Contains lengths of matches.*/
std::vector<int> lengths;
};
regex_result match_regex(string regex_string, const char* string) {
regex_result result;
regex_t* regex = new regex_t;
regcomp(regex, regex_string.c_str(), REG_EXTENDED);
/* "P" is a pointer into the string which points to the end of the
previous match. */
const char* pointer = string;
/* "n_matches" is the maximum number …Run Code Online (Sandbox Code Playgroud) libpca是一个用于主成分分析的C++库,它建立在线性代数库Armadillo之上.
不过,我遇到了问题.我将其输出与Lindsay Smith在其关于PCA的精彩教程中给出的示例进行比较.当我检索第一个主要组件时,我在他的教程中获得与Smith相同的值,但其符号被反转.对于第二主成分,符号和值是正确的.
有谁知道这是为什么?
码:
#include "pca.h"
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
stats::pca pca(2);
double* elements = new double[20]{2.5, 2.4, 0.5, 0.7, 2.2, 2.9, 1.9, 2.2, 3.1, 3.0, 2.3, 2.7, 2, 1.6, 1, 1.1, 1.5, 1.6, 1.1, 0.9};
for (int i = 0; i < 20; i++) {
vector<double> record;
record.push_back(elements[i++]);
record.push_back(elements[i]);
pca.add_record(record);
}
pca.solve();
const vector<double> principal_1 = pca.get_principal(0);
for (int i = 0; i < principal_1.size(); i++) …Run Code Online (Sandbox Code Playgroud)