小编fro*_*tto的帖子

React beautiful DnD drag out of position problem

I created a draggable drag and drop table with draggable rows.
I'm using react beautiful-dnd for this.
When I drag a row, the row gets out of position instead on the position of my cursor.
When I drag a row, the row gets position: fixed and some top and left styling.
I suspect thats the issue, but why does it get the wrong numbers, so that its causing to not show on the right position?
This GIF will show the …

reactjs react-beautiful-dnd

13
推荐指数
4
解决办法
2万
查看次数

使用objdump进行ARM体系结构:反汇编到ARM

我有一个目标文件,我试图反汇编它.我用的时候:

objdump -d example.o
Run Code Online (Sandbox Code Playgroud)

我在代码中得到一个文件格式的程序集elf64-x86-64.

我想把它拆成ARM,我该怎么做呢?

linux arm objdump disassembly

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

JNI,调用布尔方法

我得到了一个获得String并返回的Java方法boolean.

我从JNI这样称呼它:

jmethodID function2ID = env->GetMethodID(
                    activityClass,
                    "MyFuncName",
                    "(Ljava/lang/String;)B");
        if ( function2ID == null )
            LOG("Could not find MyFuncName Function")

            jboolean IsAutoPlay =    env->CallBooleanMethod(
                    obj,
                    function2ID,
                    env->NewStringUTF(name));
Run Code Online (Sandbox Code Playgroud)

我得到致命信号11,不知道语法有什么问题吗?

java java-native-interface android

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

ResultReceiver与Messenger

我正在根据此演示文稿的第一种方法实现REST客户端 - http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html

目前我正在使用ResultReceiver服务和服务助手之间的"活页夹回调",

没有任何理由,我应该更喜欢MessengerResultReceiver或者相反这个?

android android-service android-messaging

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

如何向Android窗口管理器添加浮动视图并侦听系统/硬件后退按钮事件

我有一个服务,在窗口管理器上显示浮动视图(使用WINDOW_TYPE_ALERT权限).我能够显示它并执行操作.但是,我有两个具体问题:

  1. 关于浮动视图的实现
  2. 如何监听系统后退按钮事件,以便我可以关闭视图.

执行:

在清单中,我添加了以下权限:

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
Run Code Online (Sandbox Code Playgroud)

我有一个广播接收器,它将监听报警事件.收到活动后,我正在启动服务以显示浮动视图.以下是我用来创建视图的代码.

LayoutParams layOutParams = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
                WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                PixelFormat.TRANSLUCENT);
Run Code Online (Sandbox Code Playgroud)

每当用户对视图执行任何操作时,我都会从窗口管理器中删除该视图并终止该服务.

我想知道的是 - 如果这是解决问题的正确方法,或者有更好的方法吗?而且,我应该对LayoutParams进行更改还是保持原样?

其次,当有SYSTEM BACK/HARDWARE BACK按钮按下事件时,我还想忽略这个浮动视图.有关如何执行此操作的任何指示都会有所帮助.

附上浮动视图的屏幕截图以便更好地理解:

浮动视图

android android-service android-windowmanager

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

instanceof和constructor属性之间的区别

a instanceof b确切等于a.constructor === b
如果没有,请告诉我这些之间的区别.

javascript

12
推荐指数
2
解决办法
3120
查看次数

Android 5.0(和其他设备)上的设备所有者使用root设备,通过NFC设备配置

我需要知道如何在Android 5.0,4.4和4.3(?)中将我的应用程序设置为设备所有者.我已经成功地尝试了root设备的方法(在那里描述).我看到它在android 5.0和4.4.2模拟器以及CyanoGen AOSP 4.4.4(所有有根设备)中都很有效.但是我必须在其他非root设备上尝试这个,在Android 5.0 Developer API中你可以读到这个

"要部署和激活设备所有者,您必须在设备处于未设置状态时执行从编程应用程序到设备的NFC数据传输."

但我不明白这意味着什么,或者更好,我要做什么.有人可以帮助我,还是解释我要做的一步?

PS.我知道NFC是什么以及它是如何工作的但是我无法理解如何使用这个问题.

android provisioning nfc android-5.0-lollipop

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

始终未授予OS 4.0 READ_EXTERNAL_STORAGE权限上的Android Marshmallow权限模型

在Android OS 4.0上运行我的应用程序并请求READ_EXTERNAL_STORAGE权限时出现问题:

ActivityCompat.requestPermissions(ctx, requestedPermissions, requestCode);
Run Code Online (Sandbox Code Playgroud)

我总是接受回调

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) { 

grantResults != PackageManager.PERMISSION_GRANTED
Run Code Online (Sandbox Code Playgroud)

检查权限ActivityCompat.checkSelfPermission始终返回permissionDenied.

通过系统对话框请求权限,它在OS 6.0上运行良好.Android OS 4.x除了4.0之外,总是授予权限.OS 4.0的其他权限(相机,日历,联系人,电话)表现良好,除了READ_EXTERNAL_STORAGE导致此问题.

可能是操作系统问题?

android android-permissions android-6.0-marshmallow

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

如何根据屏幕增加表格行的高度?

我想知道如何增加表格行的高度,使其在较大的屏幕尺寸中看起来相称.目前,所有textview和edittexts(放置在表格行中)都显示在屏幕的左侧,而不是占据整个屏幕(仅在较大的屏幕尺寸中).这是我正在使用的xml:

<ScrollView android:id="@+id/ScrollView01" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent" 
  xmlns:android="http://schemas.android.com/apk/res/android">     

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"

    android:layout_height="fill_parent" android:background="@color/black_background">

<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    >
  <TableRow    android:id="@+id/TableRow01" 
               android:layout_width="fill_parent" 
               android:layout_height="wrap_content" >


  <TextView  android:id="@+id/name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:textColor="@color/white" 
             android:visibility="visible" 
             android:text="@string/Name" 
             android:layout_weight="0.2"
             android:layout_marginLeft="20dp" 
             android:layout_marginTop="22dp"/>

 <EditText   android:id="@+id/myName"
             android:layout_width="120dip"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible" 
             android:layout_weight="0.3"
             android:inputType="number" 
             android:textColor="@color/black_background" 
             android:layout_marginLeft="10dp" 
             android:layout_marginTop="10dp"/>

 <TextView   android:id="@+id/error1"
              android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="18sp"
             android:textColor="@color/red" 
             android:visibility="visible" 
             android:layout_weight="0.5"/>

  </TableRow>
 <TableRow    android:id="@+id/TableRow02" 
               android:layout_width="fill_parent" 
              android:layout_height="wrap_content">


  <TextView  android:id="@+id/address"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible"
             android:textColor="@color/white" 
             android:text="@string/address" 
             android:layout_weight="0.2"
             android:layout_marginLeft="20dp" android:layout_marginTop="22dp"/>

 <EditText   android:id="@+id/address"
             android:layout_width="120dip"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible" 
             android:inputType="number" 
             android:textColor="@color/black_background" 
             android:layout_weight="0.8"
             android:layout_marginLeft="10dp" android:layout_marginTop="10dp"/>

  </TableRow> …
Run Code Online (Sandbox Code Playgroud)

android android-layout

11
推荐指数
2
解决办法
4万
查看次数

Javascript中的(1).toString()和1.toString()内部发生了什么

在JavaScript控制台中,如果键入以下内容:

1.toString();  // Uncaught SyntaxError: Invalid or unexpected token
(1).toString(); // "1"
Run Code Online (Sandbox Code Playgroud)

使用这两个语句在JS编译器中发生了什么?

javascript

11
推荐指数
2
解决办法
1175
查看次数