SlidingDrawer和Listview

时间:2013-06-20 10:13:53

标签: android listview slidingdrawer

我有一个抽屉,包含一个按钮(切换)和一个列表视图(内容)。一切正常但是当我以-100dp作为值添加android:bootomoffsetproperty时,我的ListView不再可滚动了。

有什么想法吗?

谢谢,

这是我的代码

private PHOMeteoSlidingDrawer _slide;
private ImageButton _gestionSlide;

_slide = (PHOMeteoSlidingDrawer) findViewById(R.id.slidingDrawer1);
        if(_slide.isOpened())
        {
         _slide.close();
        }

        _gestionSlide = (ImageButton)findViewById(R.id.toggle);
        _gestionSlide.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if(_slide.isOpened())
                {
                    Log.w("tag click", "tag click close");
                 _slide.close();
                }
                else {
                    Log.w("tag click", "tag click open");
                    _slide.open();
                }
            }
        });

我的课程扩展了SlidingDrawer(PHOMeteoSlidingDrawer)

public class PHOMeteoSlidingDrawer extends SlidingDrawer {

    private boolean mVertical;
    private int mTopOffset;

    public PHOMeteoSlidingDrawer(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        int orientation = attrs
                .getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
        mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
        mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
    }

    public PHOMeteoSlidingDrawer(Context context, AttributeSet attrs) {
        super(context, attrs);

        int orientation = attrs
                .getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
        mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
        mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        final long drawingTime = getDrawingTime();
        final View handle = getHandle();
        final boolean isVertical = mVertical;

        drawChild(canvas, handle, drawingTime);

        //if (mTracking || mAnimating) {
        final Bitmap cache = getContent().getDrawingCache();
        if (cache != null) {
            if (isVertical) {
                canvas.drawBitmap(cache, 0, handle.getBottom(), null);
            } else {
                canvas.drawBitmap(cache, handle.getRight(), 0, null);
            }
        } else {
            canvas.save();
            canvas.translate(isVertical ? 0 : handle.getLeft() - mTopOffset,
                        isVertical ? handle.getTop() - mTopOffset : 0);
            drawChild(canvas, getContent(), drawingTime);
            canvas.restore();
        }
        //} else if (mExpanded) {
        //drawChild(canvas, mContent, drawingTime);
        //}
    }

}

0 个答案:

没有答案