我有一个滑动抽屉,其中包含一个按钮(切换)和一个列表视图(内容)。一切正常,但是当我添加android:bootomoffsetproperty
-100dp 作为值时,我的 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);
//}
}
}