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

contentView.getMeasuredWidth() return a wrong result when use .9 image as textview's background. #6

Open
easternHong opened this issue May 23, 2017 · 1 comment

Comments

@easternHong
Copy link

    android:id="@+id/tv_pop_content"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="50dp"
    android:background="@drawable/collect_tips"
    android:gravity="center"
    android:textColor="@android:color/white"
    android:textSize="@dimen/sp13" />
public void showOnAnchor(@NonNull View anchor, @VerticalPosition int vertPos, @HorizontalPosition int horizPos, int x, int y, boolean fitInScreen) {
        setClippingEnabled(fitInScreen);
        View contentView = getContentView();
        contentView.measure(makeDropDownMeasureSpec(getWidth()), makeDropDownMeasureSpec(getHeight()));
       //i use the layout above ,and collect_tips is a .9  png.
       //so,bug occurs,the measuredW is not the real width.
        final int measuredW = contentView.getMeasuredWidth();
        final int measuredH = contentView.getMeasuredHeight();

i use the layout above ,and collect_tips is a .9 png.
so,bug occurs,the measuredW is not the real width.

@easternHong
Copy link
Author

yes, i find the solution: contentView.post(xxxshowthewindow);

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

1 participant