Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dimension #1

Open
wqycsu opened this issue Mar 30, 2015 · 2 comments
Open

Custom dimension #1

wqycsu opened this issue Mar 30, 2015 · 2 comments

Comments

@wqycsu
Copy link

wqycsu commented Mar 30, 2015

How can I set custom width and height for the PlayPauseView ?

@yoavst
Copy link

yoavst commented Jun 22, 2015

Change the dimens, and remove

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        final int size = Math.min(getMeasuredWidth(), getMeasuredHeight());
        setMeasuredDimension(size, size);
    }

At least it fixed it on Lollipop.
`

@jlnstrk
Copy link

jlnstrk commented Sep 12, 2015

Simple Change this

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    final int size = Math.min(getMeasuredWidth(), getMeasuredHeight());
    setMeasuredDimension(size, size);
}

to this

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, getResources().getDisplayMetrics());
            int size= Math.round(pixels);
            setMeasuredDimension(size,size);
         }

the the "56" is the amount of dp you want the view to have at height and width

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants