Last active
November 30, 2020 19:34
-
-
Save mikedg1/11478522 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Ask all children to measure themselves and compute the measurement of this | |
| * layout based on the children. | |
| */ | |
| @Override | |
| protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
| mPortrait = (ViewGroup) findViewById(R.id.portrait); | |
| if (mPortrait != null) { | |
| RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPortrait.getLayoutParams(); | |
| int desiredWidth = MeasureSpec.getSize(widthMeasureSpec); | |
| int desiredHeight = desiredWidth / 16 * 9; | |
| params.height = desiredHeight; | |
| mPortrait.setLayoutParams(params); | |
| } | |
| super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
| // measureChild(mWatchView,widthMeasureSpec, heightMeasureSpec); | |
| // measureChild(mWatchView, MeasureSpec.makeMeasureSpec( | |
| // currentPlayer.width(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec( | |
| // currentPlayer.height(), MeasureSpec.EXACTLY)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment