Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6215141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:00:02+00:00 2026-05-24T07:00:02+00:00

I’m new to Android programming and to stack overflow, and I need to slow

  • 0

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.

I’ve already subclassed SlidingDrawer like this:

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() > 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;

}

I found this link: How to change animation velocity on SlidingDrawer, and it says that I can find an alternative implementation, or copy the source and modify it.

I created SlidingDrawer.java in my own project and pasted the code from here, but there are errors. There are several lines that reference R.styleable.SlidingDrawer, e.g.

TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.SlidingDrawer, defStyle, 0);

which Eclipse can’t resolve.

There are also four member variables (mTop, mBottom, mLeft, mRight) which Eclipse can’t resolve.

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:00:03+00:00Added an answer on May 24, 2026 at 7:00 am

    I believe R.styleable was removed from the sdk, you can write your own though, something like this should work

    In the values folder create an xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <resources>
    <declare-styleable name="MySlider"> 
            <attr name = "SlidingDrawer_orientation"  format="integer"/>
            <attr name = "SlidingDrawer_bottomOffset" format = "dimension"/>
            <attr name = "SlidingDrawer_topOffset" format = "dimension"/>
            <attr name = "SlidingDrawer_allowSingleTap" format = "boolean"/>
            <attr name = "SlidingDrawer_animateOnClick" format = "boolean"/>
            <attr name = "SlidingDrawer_handle" format = "reference"/>
            <attr name = "SlidingDrawer_content" format = "reference"/>
        </declare-styleable>
    </resources>
    

    Then in the slider class you can reference the xml file

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MySlider, defStyle, 0);
    
    int orientation = a.getInt(R.styleable.MySlider_SlidingDrawer_orientation, ORIENTATION_VERTICAL);
    //...etc. ...
    

    I am also extending the slidingdrawer class and this works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.