[問題] 關於Android 4.4.2 Slidedrawer 問題?
這是Slidedrawer 拉上來的畫面 http://imgur.com/bPBHzda

這是Slidedrawer 拉下去的畫面 http://imgur.com/AXGmpjr

這是我的Layout 排版方式
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e0e0e0" >
<LinearLayout
android:id="@+id/openglview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>
<ImageButton
android:id="@+id/gl_auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/button_style"
android:src="@drawable/auto_rotate" />
<ImageButton
android:id="@+id/gl_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/button_style"
android:src="@drawable/reset" />
<com.example.aec3d.WrappingSlidingDrawer
android:id="@+id/slidingDrawer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:content="@+id/content"
android:handle="@+id/handle"
android:layout_alignParentBottom="true" >
<ImageView
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/info"/>
<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#7f7f7f"
android:orientation="vertical" >
<TextView
android:id="@+id/textView_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold"
android:visibility="invisible" />
<TextView
android:id="@+id/textView_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:visibility="invisible" />
</LinearLayout>
</com.example.aec3d.WrappingSlidingDrawer>
</RelativeLayout>
WrappingSlidinDrawer 是可以隨Content大小 變動大小!
public WrappingSlidingDrawer(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 WrappingSlidingDrawer(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 onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode ==
MeasureSpec.UNSPECIFIED) {
throw new RuntimeException("SlidingDrawer cannot have UNSPECIFIED
dimensions");
}
final View handle = getHandle();
final View content = getContent();
measureChild(handle, widthMeasureSpec, heightMeasureSpec);
if (mVertical) {
int height = heightSpecSize - handle.getMeasuredHeight() -
mTopOffset;
content.measure(widthMeasureSpec,
MeasureSpec.makeMeasureSpec(height, heightSpecMode));
heightSpecSize = handle.getMeasuredHeight() + mTopOffset +
content.getMeasuredHeight();
widthSpecSize = content.getMeasuredWidth();
if (handle.getMeasuredWidth() > widthSpecSize) widthSpecSize =
handle.getMeasuredWidth();
}
else {
int width = widthSpecSize - handle.getMeasuredWidth() -
mTopOffset;
getContent().measure(MeasureSpec.makeMeasureSpec(width,
widthSpecMode), heightMeasureSpec);
widthSpecSize = handle.getMeasuredWidth() + mTopOffset +
content.getMeasuredWidth();
heightSpecSize = content.getMeasuredHeight();
if (handle.getMeasuredHeight() > heightSpecSize) heightSpecSize =
handle.getMeasuredHeight();
}
setMeasuredDimension(widthSpecSize, heightSpecSize);
}
private boolean mVertical;
private int mTopOffset;
這個實作方法在4.0~4.3 都正常~不會拉下去就被擋住不見~
請問各位原因為何??
PS. openglview 為 我用addview 把opengl 放進去!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.164.124
※ 文章網址: http://www.ptt.cc/bbs/AndroidDev/M.1395885193.A.AB2.html