我正在尝试将SlidingPaneLayout与ViewPager一起使用,就像这样
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scientific_graph_slidingPaneLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--
The first child view becomes the left pane.
-->
<ListView
android:id="@+id/left_pane"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left" />
<!--
The second child becomes the right (content) pane.
-->
<android.support.v4.view.ViewPager
android:id="@+id/scientific_graph_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
</android.support.v4.widget.SlidingPaneLayout>
Run Code Online (Sandbox Code Playgroud)
当我从左边缘拉出时,SlidingPaneLayout会滑动; 但是,当我从右边缘拉出时,我似乎无法让ViewPager滑动.当我从右边缘拉出时,它滑动很少,然后快速向后滑动.
这样做甚至可能吗?有一个更好的方法吗?
我发现通过向上移动手指向左移动,我可以滑动视图寻呼机.
我有类似的东西:
typedef struct Data DATA, *DATA_PTR;
typedef struct Units UNITS, *UNITS_PTR;
struct Data
{
double miscData;
UNITS units;
};
struct Units
{
double x[2];
double y[2];
double z[2];
};
Run Code Online (Sandbox Code Playgroud)
在我的project_typedef.h档案中.
在另一个文件中,我有类似的东西:
void fileInput(DATA_PTR data)
{
//usual declarations and other things
data->miscData = 0; //Works!
data->units.x[0] = 5; //Doesn't work
//etc...
}
Run Code Online (Sandbox Code Playgroud)
但是,这不起作用,因为单位是在数据之后声明的 project_typedef.h(如果我切换它的工作顺序).我得到的错误是"左'.x'必须有struct/union类型".我认为前方声明会解决这个问题.为什么不?
我正在启用GPU的计算机上编写代码,但是我的代码需要可移植到没有GPU的计算机上。所以我写了2个函数,一个仅使用CPU,另一个使用CPU + GPU。
我需要有条件的合规性代码,例如:
if (COMPUTER_HAS_GPU)
//Run CPU+GPU code
else
//Run CPU only code
Run Code Online (Sandbox Code Playgroud)
有没有这样的东西?