Note that there are some explanatory texts on larger screens.

plurals
  1. POChange absolute position with FrameLayout
    primarykey
    data
    text
    <p>I has a View that should be displayed at a specific position over some images, I already did that using AbsoluteLayout, but I don't want to use it and I'm trying to get the same result with a FrameLayout.</p> <p>But I can't get this working, this is my two attempts:</p> <pre><code>public void showVideo(RectF bounds) { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) video.getLayoutParams(); params.width = (int) bounds.width(); params.height = (int) bounds.height(); int x = (int) viewer.getPageXOffset(); int y = (int) viewer.getPageYOffset(); video.setPadding((int) (x + bounds.left), (int) (y + bounds.top), (int) (x + bounds.right), (int) (y + bounds.bottom)); video.setLayoutParams(params); video.invalidate(); video.setVisibility(View.VISIBLE); video.setFocusable(true); video.setFocusableInTouchMode(true); video.requestFocus(); } </code></pre> <p>And:</p> <pre><code>public void showVideo(RectF bounds, final String videoUrl) { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) video.getLayoutParams(); params.width = (int) bounds.width(); params.height = (int) bounds.height(); int x = (int) (viewer.getPageXOffset() + bounds.left); int y = (int) (viewer.getPageYOffset() + bounds.top); params.leftMargin = x; params.topMargin = y; video.setLayoutParams(params); video.invalidate(); video.setVisibility(View.VISIBLE); video.setFocusable(true); video.setFocusableInTouchMode(true); video.requestFocus(); } </code></pre> <p>But in both cases, the VideoView are displayed at v(0,0) (left-top corner).</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.
    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