问题描述
我试图创建一个SlidingDrawer与LinearLayout中含量超过的FrameLayout。
I'm trying to create a SlidingDrawer with LinearLayout content over a FrameLayout.
起初,这一切似乎罚款,我让我的SlidingDrawer的手柄在屏幕的底部。不过,如果我开始拖动手柄和内容开始显示,它就会通过手柄的边框矩形裁剪。如果我一路拖动手柄向上的全部内容最终被显示,但如果我现在拖动手柄向下,它将由内容的矩形边框被裁剪。此外,如果手柄是一路上涨,当我开始拖动它的全部内容消失。
我仍然可以点击那里的手柄应该是在屏幕上,拖动和内容将显示,但我需要猜出手柄。
At first it all seems fine, I get my SlidingDrawer's handle at the bottom of the screen.But then, if I start dragging the handle up and the content starts showing, it gets clipped by the border rectangle of the handle. If I drag the handle all the way up the entire content eventually gets shown, however if I now drag the handle down, it will be clipped by the border rectangle of the content. Also, if the handle is all the way up, as soon as I start dragging it the whole content disappears.
I can still click on where the handle should be on the screen, drag it and the content would show, but I need to guess where the handle is.
什么似乎导致,这是事实,我在短短SlidingDrawer之前的XML文件中的SurfaceView。
删除从XML的观点解决了这个问题,但我需要这个观点。
What seems to be causing this is the fact that I have a SurfaceView in the xml file just before SlidingDrawer.
Removing the view from the xml solves this problem, however I need this view.
这里的XML:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Removing this DrawView from here solves the problem -->
<com.package.DrawView
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<SlidingDrawer
android:id="@+id/SlidingDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:allowSingleTap="true"
android:animateOnClick="true"
android:handle="@+id/slideHandleButton"
android:content="@+id/contentLayout"
android:padding="10dip">
<Button
android:id="@+id/slideHandleButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/sliding_button">
</Button>
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/clearButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test">
</Button>
</LinearLayout>
</SlidingDrawer>
</FrameLayout>
Java的:
Java:
package com.package;
import android.app.Activity;
import android.os.Bundle;
public class SlideTest extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
package com.package;
import android.content.Context;
import android.util.AttributeSet;
import android.view.SurfaceView;
public class DrawView extends SurfaceView
{
public DrawView(Context context, AttributeSet attrs) {
super(context, attrs);
}
}
编辑:我刚刚注意到,如果drawView函数扩展视图,而不是SurfaceView这个问题消失。但是,我使用的是专用的绘图线程,并根据文件(和LunarLander例子)使用专用的绘图线程时,应制订一个SurfaceView。
I just noticed that if DrawView extends View and not SurfaceView this problem goes away.However, I'm using a dedicated drawing thread and according to the documentation (and LunarLander example) when using a dedicated drawing thread, it should draw to a SurfaceView.
任何帮助将是很大的AP preciated!
Any help would be greatly appreciated!
推荐答案
安卓背景=#00000000
android:background="#00000000"
背景颜色是问题。
这篇关于安卓:在SurfaceView SlidingDrawer消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!