我在滚动视图内的活动中有两个片段。我可以同时显示这两种图像,但是当我要收缩缩放或移动街景视图时,它无法正常工作。我有任何解决方案可以使其正常工作。
这是活动视图:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">
// fragment 1 related view
<ImageView
android:id="@+id/imgView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
// fragment 2 related view
<com.google.android.gms.maps.StreetViewPanoramaView
android:id="@+id/streetViewPanorama"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/streetView" />
</androidx.core.widget.NestedScrollView>
答案 0 :(得分:0)
我采用了一个#include<iostream>
#include <openssl/bn.h>
using namespace std;
class testClass{
public:
int nr_bits;
BIGNUM * number1 = NULL;
testClass(int nr_bits){
this->nr_bits = nr_bits;
//BIGNUM * number1 = NULL;
this->number1 = BN_new();
cout << "number1 is: " << number1 << endl;
}
};
int main(){
testClass * test = new testClass(10);
return 0;
}
类,该类扩展了CustomStreetViewPanoramaView
类,然后将requestDisallowInterceptTouchEvent设置为true,将requestDisallowInterceptTouchEvent设置为false。
StreetViewPanoramaView
然后在XML中而不是使用class CustomStreetViewPanoramaView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : StreetViewPanoramaView(context, attrs, defStyleAttr) {
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
parent.parent.requestDisallowInterceptTouchEvent(true)
}
MotionEvent.ACTION_UP -> {
parent.parent.requestDisallowInterceptTouchEvent(false)
}
}
return super.onInterceptTouchEvent(event)
}
}
,将其替换为带有包(com.google.android.gms.maps.StreetViewPanoramaView
)的自定义类,例如:
com.yourpackage.name.CustomStreetViewPanoramaView
它现在按预期工作。可能对某人有用。