为什么numpy.ndarray.resize()返回None

时间:2016-11-30 11:31:34

标签: python numpy

我运行以下代码以获得2乘3的数组:

import numpy as np
a = np.arange(6).resize(2,3)
print(a)

然而,输出是

None

这是为什么?非常感谢

1 个答案:

答案 0 :(得分:3)

你想做的是

    //mRecyclerView.setAccessibilityDelegate(mAccessibilityDelegate);
    RVAccessibilityDelegate rvAccessibilityDelegate = new RVAccessibilityDelegate(mRecyclerView, mAssistant);
    mRecyclerView.setAccessibilityDelegateCompat(rvAccessibilityDelegate);

使用调整大小:

public class RVAccessibilityDelegate extends RecyclerViewAccessibilityDelegate {

private Assistant mAssistant;

public RVAccessibilityDelegate(RecyclerView recyclerView, Assistant assistant) {
    super(recyclerView);
    mAssistant = assistant;
}

@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
    if(!mAssistant.isSpeaking() && mAssistant.isRecognizerAvailable())
    {
        return super.performAccessibilityAction(host, action, args);
    }

    return false;
}

@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
}

@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
}

@Override
public void sendAccessibilityEvent(View host, int eventType) {
    if(!mAssistant.isSpeaking() && mAssistant.isRecognizerAvailable())
    {
        super.sendAccessibilityEvent(host, eventType);
    }
}

@Override
public void sendAccessibilityEventUnchecked(View host, AccessibilityEvent event) {
    //super.sendAccessibilityEventUnchecked(host, event);
}

@Override
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
    return super.dispatchPopulateAccessibilityEvent(host, event);
}

@Override
public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onPopulateAccessibilityEvent(host, event);
}

@Override
public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event) {
    return super.onRequestSendAccessibilityEvent(host, child, event);
}

@Override
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View host) {
    return super.getAccessibilityNodeProvider(host);
}