FrameLayout上にLinearLayoutコンテンツを含むSlidingDrawerを作成しようとしています。
最初はすべて問題ないようですが、画面の下部にSlidingDrawerのハンドルがあります。しかし、ハンドルを上にドラッグし始めてコンテンツが表示され始めると、ハンドルの境界線の長方形によってクリップされます。ハンドルを一番上までドラッグすると、コンテンツ全体が最終的に表示されますが、ハンドルを下にドラッグすると、コンテンツの境界線の長方形によってクリップされます。また、ハンドルが完全に上がっている場合は、ドラッグを開始するとすぐにコンテンツ全体が表示されなくなります。
画面上のハンドルの位置をクリックしてドラッグすると、コンテンツが表示されますが、ハンドルの位置を推測する必要があります。
これを引き起こしていると思われるのは、SlidingDrawerの直前のxmlファイルにSurfaceViewがあるという事実です。
xmlからビューを削除するとこの問題は解決しますが、このビューが必要です。
これが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:
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ではなくViewを拡張すると、この問題がなくなることに気づきました。ただし、私は専用の描画スレッドを使用しており、ドキュメント(およびLunarLanderの例)によると、専用の描画スレッドを使用すると、SurfaceViewに描画する必要があります。
どんな助けでも大歓迎です!