小编jas*_*son的帖子

打开抽屉时,在右侧推动活动

我已经实现了从右侧滑动的drawerlayout,但它并没有像facebook那样改变活动(见下图).当用户点击上面的图像中的opendrawer按钮时,如何将当前活动推到右侧.目前它出现在活动之上并且掉落阴影.我非常感谢任何帮助.提前致谢.

在此输入图像描述

android facebook navigation-drawer

37
推荐指数
5
解决办法
3万
查看次数

如何在ViewPager中启用CardView

我尝试在ViewPager中使用CardView,每次我在CardView上向左/向右滑动它都会进入下一个屏幕.我想让卡片自己删除.目前作为一个独立的都工作正常,但当我结合时,只有viewpager工作,而不是cardwipe解雇.

我尝试使用下面的代码禁用ViewPager,但此代码也禁用了CardView滑动手势.我怎样才能让CardView有手势,当你在两张卡之间滑动时,它应该有ViewPager,因为它没有连接到卡元素.

或者完全禁用ViewPager并将其用作按钮并在CardView上启用滑动.我非常感谢任何帮助.提前致谢.

仅供参考:我在ViewPager中尝试过android_horizo​​ntal_listview,它运行正常,就像这样.

对于ViewPager:

mPager.setOnTouchListener(new OnTouchListener()
{           
    @Override
    public boolean onTouch(View v, MotionEvent event)
    {
        return true;
    }
});
Run Code Online (Sandbox Code Playgroud)

对于CardView:

SwipeableRecyclerViewTouchListener swipeTouchListener =

new SwipeableRecyclerViewTouchListener(mRecyclerView,
    new SwipeableRecyclerViewTouchListener.SwipeListener() {
        @Override
        public boolean canSwipe(int position) {
            return true;
        }

        @Override
        public void onDismissedBySwipeLeft(RecyclerView recyclerView, int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                mItems.remove(position);
                mAdapter.notifyItemRemoved(position);
            }
            mAdapter.notifyDataSetChanged();
        }

        @Override
        public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                mItems.remove(position);
                mAdapter.notifyItemRemoved(position);
            }
            mAdapter.notifyDataSetChanged();
        }
    });

mRecyclerView.addOnItemTouchListener(swipeTouchListener);
Run Code Online (Sandbox Code Playgroud)

Mainactivity.java

public …
Run Code Online (Sandbox Code Playgroud)

android android-viewpager android-cardview

19
推荐指数
1
解决办法
8607
查看次数

如何在android中添加aws签名并调用aws api网关

我写了这段代码,但是我收到了一个错误.我怎么去上班?但同样的道理也适用于邮递员.

错误:

 {"message":"The security token included in the request is invalid."}
Run Code Online (Sandbox Code Playgroud)

代码:

public class test extends AppCompatActivity {

    private final AWS4Signer signer = new AWS4Signer();
    Request<?> aws;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);

         AWSCredentials credentials = new BasicAWSCredentials("AccessKey", "SecretKey");
        aws = generateBasicRequest();
        signer.setServiceName("execute-api");
        signer.sign(aws, credentials);

        new get_aws().execute();

    }

    private Request<?> generateBasicRequest() {
         Request<?> request = new DefaultRequest<Void>("execute-api");
        request.addHeader("Content-type", "application/json");
         String securityToken = "Session Token";

        request.addHeader("X-Amz-Security-Token", securityToken);
        request.addHeader("Host", "********.amazonaws.com");
        request.addHeader("x-amz-archive-description", "test  test");
        request.setResourcePath("/");
        request.setEndpoint(URI.create("https://******.execute-api.****.amazonaws.com/data/all"));
        return request;
    }


    private class …
Run Code Online (Sandbox Code Playgroud)

android amazon-web-services aws-api-gateway

14
推荐指数
1
解决办法
1039
查看次数

如何使用Google Maps API v2确定lat长坐标是否在路上

我使用了谷歌地理地址并使用lat/long获得了地址.我如何确定我是否在路上?对道路进行基本打击测试?我目前正在使用lat/long的位置管理器,并且GeoAddress在路上和路旁都是相同的.

android google-maps-android-api-2

12
推荐指数
1
解决办法
1万
查看次数

from .cv2 import * ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

为 opencv 执行 docker 文件时出现此错误:

错误:

from .cv2 import * ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

Dockerfile:

FROM jjanzic/docker-python3-opencv
COPY . /app
WORKDIR /app

RUN pip3 install -r requirements.txt


ENTRYPOINT ["python3"]
CMD ["app.py"]
Run Code Online (Sandbox Code Playgroud)

需求.txt

opencv-contrib-python-headless==3.4.3.18
Click==7.0
cloudpickle==0.6.1
cycler==0.10.0
dask==0.20.1
decorator==4.3.0
Flask==1.0.2
imutils==0.5.1
itsdangerous==1.1.0
Jinja2==2.10
kiwisolver==1.0.1
MarkupSafe==1.1.0
networkx==2.2
numpy==1.15.4
Pillow==5.3.0
pyparsing==2.3.0
python-dateutil==2.7.5
PyWavelets==1.0.1
scikit-image==0.14.1
scipy==1.1.0
six==1.11.0
toolz==0.9.0
Werkzeug==0.14.1
Run Code Online (Sandbox Code Playgroud)

请告诉我如何修复它?

python opencv docker

12
推荐指数
0
解决办法
1万
查看次数

我无法在docker中安装opencv-contrib-python

我尝试安装opencv-contrib-python,但我无法让它在docker上工作.它说 无法找到满足opencv-contrib-python要求的版本

我试过了,

pip install opencv-contrib-python-headless
Run Code Online (Sandbox Code Playgroud)

然后,我累了 https://github.com/cassiobotaro/docker-opencv-contrib/blob/master/Dockerfile ,我也尝试过,

    FROM python:3.5-alpine

    COPY . /app
    WORKDIR /app


    RUN apk add --no-cache ca-certificates
    RUN apk add --no-cache git build-base musl-dev alpine-sdk cmake clang clang-dev make gcc g++ libc-dev linux-headers

    RUN mkdir /tmp/opencv
    WORKDIR /tmp/opencv
    RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.1.zip
    RUN unzip opencv.zip
    RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.1.zip
    RUN unzip opencv_contrib.zip
    RUN mkdir /tmp/opencv/opencv-3.4.1/build

    WORKDIR /tmp/opencv/opencv-3.4.1/build
    RUN cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv/opencv_contrib-3.4.1/modules -D BUILD_DOCS=OFF BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF …
Run Code Online (Sandbox Code Playgroud)

python opencv docker

11
推荐指数
1
解决办法
2691
查看次数

当在片段中重新打开时,android maps v2崩溃

谷歌地图v2 android第一次加载,然后我切换到其他片段,当我回来映射片段它崩溃.我已经附加下面的代码:我真的很感激任何帮助.谢谢你提前.

fragmentMain中地图的代码:

public class FragmentMain extends Fragment {
    TextView textView;

    static final LatLng HAMBURG = new LatLng(53.558, 9.927);
    static final LatLng test = new LatLng(53.551, 9.993);
    private GoogleMap map;

    public FragmentMain() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main, null);
        map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

                Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
                    .title("Hamburg"));

                Marker test = map.addMarker(new MarkerOptions()
                    .position(test)
                    .title("test")
                    .snippet("test")
                    .icon(BitmapDescriptorFactory
                        .fromResource(R.drawable.ic_launcher)));

                // Move the camera instantly to hamburg with a zoom of …
Run Code Online (Sandbox Code Playgroud)

android google-maps android-fragments google-maps-android-api-2

9
推荐指数
2
解决办法
4941
查看次数

如何在材质设计android中自定义TimePicker?

我无法更改选择器颜色和TimePicker的其他部分.到目前为止,我可以更改标题颜色和背景,但我无法更改innercircle和textcolor.

更改自定义主题链接.

我的代码:

<TimePicker
    android:id="@+id/tp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:timePickerMode="clock"
    android:headerBackground="#565466"
    android:amPmBackgroundColor="#500126"
    android:numbersBackgroundColor="#57e326"
    android:numbersTextColor="#995394"
    android:numbersSelectorColor="#675543"
    android:textColorSecondary="#897530"
    android:textColorPrimary="#359875"
/>
Run Code Online (Sandbox Code Playgroud)

android android-theme android-timepicker

9
推荐指数
2
解决办法
1万
查看次数

根据到期时间获取行

http://sqlfiddle.com/#!9/406cb/2

我有1类,2类,3类,4类书桌.

  • 第1类 - 将停留1小时
  • 第2类 - 将停留2小时
  • 第3类 - 将停留4小时
  • 第4类 - 将停留6小时

如何编写查询以获得所需结果?

例如:

  1. 如果当前时间是1454411248那么它应该显示所有书籍
  2. 如果当前时间是1454414847那么它不应该显示带有unixtime = 1454411248的类别1书籍(一小时后到期)
  3. 如果当前时间是1454418448,则类别 - 1,2,3,4低于1,2,4小时的到期时间不应显示(unix_time将是动态的.例如我使用静态值).

等......

表:

CREATE TABLE `books` (
    `id` int(255) NOT NULL AUTO_INCREMENT,
    `name` longtext NOT NULL,
    `category` varchar(255) NOT NULL,
    `unix_time` bigint(20) NOT NULL,
    `time_data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;


INSERT INTO `books` (`id`, `name`, `category`, `unix_time`, `time_data`) VALUES
    (1, 'book1', '1', 1454411248, '2016-02-02 …
Run Code Online (Sandbox Code Playgroud)

mysql sql

9
推荐指数
1
解决办法
229
查看次数

引起:java.lang.IllegalArgumentException:无法猜测com.example.example.databinding.ContentClassApplicationMyClass1Binding

我将Android工作室从3.0更新到3.1并将Gradle从3.1更新到4.4后,我在android中遇到此错误.

我该如何解决?

它与Gradle 3.1和android studio 3.0一起正常工作.

我怎样才能让它发挥作用?

Gradle app:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'

    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {

    mavenCentral()
    google()
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 27

    dataBinding {
        enabled = true
    }

    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 22
        targetSdkVersion 23
        versionCode 13
        versionName "1.13"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true

        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin android-studio-3.1

8
推荐指数
2
解决办法
7780
查看次数