Skip to content

SliderLayout aspect ratio  #410

Open
@mus9876

Description

@mus9876

I have made a custom sliderLayout in order to get the wanted aspect ratio, but unfortunately, the image will disappear completely.

my code:-

public class CustomSliderLayout extends SliderLayout {

public CustomSliderLayout(Context context) {
    super(context);
}
public CustomSliderLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public CustomSliderLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
    int height = (int) (width / 1.65);
    setMeasuredDimension(width, height);
}

}

2019-04-04_145740

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions