Twowayview垂直滚动条不适用于外部scrollview。如何使其正确。需要帮助!
<ScrollView>
...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:nestedScrollingEnabled="true">
<org.lucasr.twowayview.TwoWayView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/idSubCat"
style="@style/TwoWayView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:orientation="vertical"
android:drawSelectorOnTop="false" />
</LinearLayout>
...
</ScrollView>
答案 0 :(得分:0)
也许尝试将public class PhotoCaptureExample : MonoBehaviour
{
PhotoCapture photoCaptureObject = null;
bool capturing = false;
// Use this for initialization
void Start ()
{
PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
}
void OnPhotoCaptureCreated(PhotoCapture captureObject)
{
photoCaptureObject = captureObject;
Resolution cameraResolution = PhotoCapture.SupportedResolutions
.OrderByDescending((res) => res.width * res.height).First();
CameraParameters c = new CameraParameters();
c.hologramOpacity = 0.0f;
c.cameraResolutionWidth = cameraResolution.width;
c.cameraResolutionHeight = cameraResolution.height;
c.pixelFormat = CapturePixelFormat.BGRA32;
captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
}
void OnStoppedPhotoMode(PhotoCapture.PhotoCaptureResult result)
{
photoCaptureObject.Dispose();
photoCaptureObject = null;
}
private void OnPhotoModeStarted(PhotoCapture.PhotoCaptureResult result)
{
if (result.success)
{
capturing = true
while(capturing)
{
try
{
photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
}
catch (Exception e)
{
// Do something
capturing = false;
// Clean up
photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode);
}
}
}
else
{
Debug.LogError("Unable to start photo mode!");
}
}
void OnCapturedPhotoToMemory(PhotoCapture.PhotoCaptureResult result,
PhotoCaptureFrame photoCaptureFrame)
{
if (result.success)
{
// Create our Texture2D for use and set the correct resolution
Resolution cameraResolution = PhotoCapture.SupportedResolutions
.OrderByDescending((res) => res.width * res.height).First();
Texture2D targetTexture = new Texture2D(cameraResolution.width,
cameraResolution.height);
// Copy the raw image data into our target texture
photoCaptureFrame.UploadImageDataToTexture(targetTexture);
// Do as we wish with the texture such as apply it to a material, etc.
}
}
// Update is called once per frame
void Update ()
{
if(!capturing)
{
// to ensure the photos are continuously being captured
Start();
}
}
}
更改为android:layout_width="match_parent"
答案 1 :(得分:0)
我一次遇到了相同的错误,因为TWV仅适用于wrap_content,而我最终使用了RecyclerView。