Note that there are some explanatory texts on larger screens.

plurals
  1. POSlidingDrawer animation velocity
    primarykey
    data
    text
    <p>I'm new to Android programming and to stack overflow, and I need to slow down the animation speed of a SlidingDrawer in my app.</p> <p>I've already subclassed SlidingDrawer like this:</p> <pre><code>import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.SlidingDrawer; public class WrappingSlidingDrawer extends SlidingDrawer { 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() &gt; 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() &gt; heightSpecSize) heightSpecSize = handle.getMeasuredHeight(); } setMeasuredDimension(widthSpecSize, heightSpecSize); } private boolean mVertical; private int mTopOffset; </code></pre> <p>}</p> <p>I found this link: <a href="http://groups.google.com/group/android-developers/browse_thread/thread/a7d0102811474bfe" rel="nofollow">How to change animation velocity on SlidingDrawer</a>, and it says that I can find an alternative implementation, or copy the source and modify it. </p> <p>I created SlidingDrawer.java in my own project and pasted the code from <a href="http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/android/widget/SlidingDrawer.java.htm" rel="nofollow">here</a>, but there are errors. There are several lines that reference R.styleable.SlidingDrawer, e.g.</p> <pre><code>TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlidingDrawer, defStyle, 0); </code></pre> <p>which Eclipse can't resolve.</p> <p>There are also four member variables (mTop, mBottom, mLeft, mRight) which Eclipse can't resolve.</p> <p>How do I make Eclipse find these resources/variables? I will then be able to edit some variables to result in a slower animation, right?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload