View gets cropped above 10.000 pixel width The 2019 Stack Overflow Developer Survey Results Are InGet screen dimensions in pixelsHow to get the absolute coordinates of a viewGet root view from current activityHow to get the width and height of an android.widget.ImageView?Get screen width and height in AndroidHow do I initiate xml-defined surface view via button press?No video display when playing an mp4 file on Androidandroid: camera onPause/onResume issueAndroid custom image view shapeView.SurfaceView, why its member, mSurfaceHolder, returns null from getSurface()?
Return to UK after having been refused entry years ago
Did 3000BC Egyptians use meteoric iron weapons?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
What is the meaning of the verb "bear" in this context?
What is the accessibility of a package's `Private` context variables?
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
Is this app Icon Browser Safe/Legit?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Can a flute soloist sit?
One word riddle: Vowel in the middle
What is the most effective way of iterating a std::vector and why?
Who coined the term "madman theory"?
What did it mean to "align" a radio?
Origin of "cooter" meaning "vagina"
Why isn't airport relocation done gradually?
Are there any other methods to apply to solving simultaneous equations?
Delete all lines which don't have n characters before delimiter
Is an up-to-date browser secure on an out-of-date OS?
Is flight data recorder erased after every flight?
How to support a colleague who finds meetings extremely tiring?
Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?
Why not take a picture of a closer black hole?
How technical should a Scrum Master be to effectively remove impediments?
How to save as into a customized destination on macOS?
View gets cropped above 10.000 pixel width
The 2019 Stack Overflow Developer Survey Results Are InGet screen dimensions in pixelsHow to get the absolute coordinates of a viewGet root view from current activityHow to get the width and height of an android.widget.ImageView?Get screen width and height in AndroidHow do I initiate xml-defined surface view via button press?No video display when playing an mp4 file on Androidandroid: camera onPause/onResume issueAndroid custom image view shapeView.SurfaceView, why its member, mSurfaceHolder, returns null from getSurface()?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
UPDATE:
Works on Emulator with Android Oreo (8.X). I have the possibility to do changes right to the android sources, so it would also help if someone knews what in the android sources I have to change or update to get this working (so I don't really need an Android 7 workaround for this. An update to Android 8 though is not possible.)
I'm having a SurfaceView inside a FrameLayout. The SurfaceView usually displays a video, for example purposes I'm actually drawing an image.
The problem is, if I'm setting the size of the FrameLayout (or the SurfaceView) above 10.000 pixels in width, it gets cropped on the left side.
Tested on Android 7.1.1 (on a device and Emulator: Android TV (1080p) API 25
public class TestActivity extends Activity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
//add surfaceview
TestSurfaceView testSurfaceView = new TestSurfaceView(this);
setContentView(testSurfaceView);
//resize
FrameLayout.LayoutParams bgParams = (FrameLayout.LayoutParams) testSurfaceView.getLayoutParams();
//testcase full hd - working
bgParams.width = 1920;
//testcase 2 - working - each segment is 330px as 9900 / 1920 * 64 (default segment width) == 330
//bgParams.width = 9900;
//testcase 3 - working
//bgParams.width = 10000;
//testcase 4 - not working - each segment is 335px which is correct but first cell gets cropped by exactly 50px to the left
//bgParams.width = 10050;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
testSurfaceView.setX(0); //doesnt help
/*
Also the position counts into the 10000px limitation as you can see on following testcases
*/
/*
bgParams.width = 9900;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
//works - as 9900 + 90 < 10000
testSurfaceView.setX(90);
//doesnt work, crops 50px to the left - 9900 + 150 -> 10050
testSurfaceView.setX(150);
*/
public class TestSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public TestSurfaceView(TestActivity context)
super(context);
SurfaceHolder holder = this.getHolder();
holder.addCallback(this);
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder)
//load bitmap from file
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/testimg.png", options);
Canvas c = surfaceHolder.lockCanvas();
Rect rect = new Rect();
rect.set(0,0, 1920, 1080); //image size
Rect destRect = new Rect();
destRect.set(0, 0, this.getWidth(), this.getHeight());
//draw the image on the surface
c.drawBitmap(bitmap, rect, destRect, null);
surfaceHolder.unlockCanvasAndPost(c);
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
@Override
public void surfaceDestroyed(SurfaceHolder holder)
styles.xml - for the theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
</resources>
The code above produces following output, which is correct.
If I change the bgParams.width
to 9600 - it scales up correctly and still displays starting from the left edge of the image:
But if I change the code to e.g. 10050, the image gets cropped by 50 pixels to the left.
If I set:
destRect.set(50, 0, this.getWidth(), this.getHeight());
It gets displayed correctly, but as I can't do that for the MediaPlayer and it's super weird, I'm trying to find a good solution.
I also tried setting the sizes directly on the SurfaceView and instead of changing the LayoutParams, I tried setting scaleX and scaleY of the Framelayout but ended up with the same results.
(btw. opengl max texture size is about 16000px - setting it above the ~16000px results in a black screen and an exception, so that is not the cause of the problem)
Update:
Posted all sources. Anyway here is the complete android studio project:
WeTransfer project download link
android surfaceview android-source android-7.0-nougat android-x86
|
show 13 more comments
UPDATE:
Works on Emulator with Android Oreo (8.X). I have the possibility to do changes right to the android sources, so it would also help if someone knews what in the android sources I have to change or update to get this working (so I don't really need an Android 7 workaround for this. An update to Android 8 though is not possible.)
I'm having a SurfaceView inside a FrameLayout. The SurfaceView usually displays a video, for example purposes I'm actually drawing an image.
The problem is, if I'm setting the size of the FrameLayout (or the SurfaceView) above 10.000 pixels in width, it gets cropped on the left side.
Tested on Android 7.1.1 (on a device and Emulator: Android TV (1080p) API 25
public class TestActivity extends Activity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
//add surfaceview
TestSurfaceView testSurfaceView = new TestSurfaceView(this);
setContentView(testSurfaceView);
//resize
FrameLayout.LayoutParams bgParams = (FrameLayout.LayoutParams) testSurfaceView.getLayoutParams();
//testcase full hd - working
bgParams.width = 1920;
//testcase 2 - working - each segment is 330px as 9900 / 1920 * 64 (default segment width) == 330
//bgParams.width = 9900;
//testcase 3 - working
//bgParams.width = 10000;
//testcase 4 - not working - each segment is 335px which is correct but first cell gets cropped by exactly 50px to the left
//bgParams.width = 10050;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
testSurfaceView.setX(0); //doesnt help
/*
Also the position counts into the 10000px limitation as you can see on following testcases
*/
/*
bgParams.width = 9900;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
//works - as 9900 + 90 < 10000
testSurfaceView.setX(90);
//doesnt work, crops 50px to the left - 9900 + 150 -> 10050
testSurfaceView.setX(150);
*/
public class TestSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public TestSurfaceView(TestActivity context)
super(context);
SurfaceHolder holder = this.getHolder();
holder.addCallback(this);
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder)
//load bitmap from file
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/testimg.png", options);
Canvas c = surfaceHolder.lockCanvas();
Rect rect = new Rect();
rect.set(0,0, 1920, 1080); //image size
Rect destRect = new Rect();
destRect.set(0, 0, this.getWidth(), this.getHeight());
//draw the image on the surface
c.drawBitmap(bitmap, rect, destRect, null);
surfaceHolder.unlockCanvasAndPost(c);
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
@Override
public void surfaceDestroyed(SurfaceHolder holder)
styles.xml - for the theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
</resources>
The code above produces following output, which is correct.
If I change the bgParams.width
to 9600 - it scales up correctly and still displays starting from the left edge of the image:
But if I change the code to e.g. 10050, the image gets cropped by 50 pixels to the left.
If I set:
destRect.set(50, 0, this.getWidth(), this.getHeight());
It gets displayed correctly, but as I can't do that for the MediaPlayer and it's super weird, I'm trying to find a good solution.
I also tried setting the sizes directly on the SurfaceView and instead of changing the LayoutParams, I tried setting scaleX and scaleY of the Framelayout but ended up with the same results.
(btw. opengl max texture size is about 16000px - setting it above the ~16000px results in a black screen and an exception, so that is not the cause of the problem)
Update:
Posted all sources. Anyway here is the complete android studio project:
WeTransfer project download link
android surfaceview android-source android-7.0-nougat android-x86
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54
|
show 13 more comments
UPDATE:
Works on Emulator with Android Oreo (8.X). I have the possibility to do changes right to the android sources, so it would also help if someone knews what in the android sources I have to change or update to get this working (so I don't really need an Android 7 workaround for this. An update to Android 8 though is not possible.)
I'm having a SurfaceView inside a FrameLayout. The SurfaceView usually displays a video, for example purposes I'm actually drawing an image.
The problem is, if I'm setting the size of the FrameLayout (or the SurfaceView) above 10.000 pixels in width, it gets cropped on the left side.
Tested on Android 7.1.1 (on a device and Emulator: Android TV (1080p) API 25
public class TestActivity extends Activity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
//add surfaceview
TestSurfaceView testSurfaceView = new TestSurfaceView(this);
setContentView(testSurfaceView);
//resize
FrameLayout.LayoutParams bgParams = (FrameLayout.LayoutParams) testSurfaceView.getLayoutParams();
//testcase full hd - working
bgParams.width = 1920;
//testcase 2 - working - each segment is 330px as 9900 / 1920 * 64 (default segment width) == 330
//bgParams.width = 9900;
//testcase 3 - working
//bgParams.width = 10000;
//testcase 4 - not working - each segment is 335px which is correct but first cell gets cropped by exactly 50px to the left
//bgParams.width = 10050;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
testSurfaceView.setX(0); //doesnt help
/*
Also the position counts into the 10000px limitation as you can see on following testcases
*/
/*
bgParams.width = 9900;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
//works - as 9900 + 90 < 10000
testSurfaceView.setX(90);
//doesnt work, crops 50px to the left - 9900 + 150 -> 10050
testSurfaceView.setX(150);
*/
public class TestSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public TestSurfaceView(TestActivity context)
super(context);
SurfaceHolder holder = this.getHolder();
holder.addCallback(this);
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder)
//load bitmap from file
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/testimg.png", options);
Canvas c = surfaceHolder.lockCanvas();
Rect rect = new Rect();
rect.set(0,0, 1920, 1080); //image size
Rect destRect = new Rect();
destRect.set(0, 0, this.getWidth(), this.getHeight());
//draw the image on the surface
c.drawBitmap(bitmap, rect, destRect, null);
surfaceHolder.unlockCanvasAndPost(c);
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
@Override
public void surfaceDestroyed(SurfaceHolder holder)
styles.xml - for the theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
</resources>
The code above produces following output, which is correct.
If I change the bgParams.width
to 9600 - it scales up correctly and still displays starting from the left edge of the image:
But if I change the code to e.g. 10050, the image gets cropped by 50 pixels to the left.
If I set:
destRect.set(50, 0, this.getWidth(), this.getHeight());
It gets displayed correctly, but as I can't do that for the MediaPlayer and it's super weird, I'm trying to find a good solution.
I also tried setting the sizes directly on the SurfaceView and instead of changing the LayoutParams, I tried setting scaleX and scaleY of the Framelayout but ended up with the same results.
(btw. opengl max texture size is about 16000px - setting it above the ~16000px results in a black screen and an exception, so that is not the cause of the problem)
Update:
Posted all sources. Anyway here is the complete android studio project:
WeTransfer project download link
android surfaceview android-source android-7.0-nougat android-x86
UPDATE:
Works on Emulator with Android Oreo (8.X). I have the possibility to do changes right to the android sources, so it would also help if someone knews what in the android sources I have to change or update to get this working (so I don't really need an Android 7 workaround for this. An update to Android 8 though is not possible.)
I'm having a SurfaceView inside a FrameLayout. The SurfaceView usually displays a video, for example purposes I'm actually drawing an image.
The problem is, if I'm setting the size of the FrameLayout (or the SurfaceView) above 10.000 pixels in width, it gets cropped on the left side.
Tested on Android 7.1.1 (on a device and Emulator: Android TV (1080p) API 25
public class TestActivity extends Activity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
//add surfaceview
TestSurfaceView testSurfaceView = new TestSurfaceView(this);
setContentView(testSurfaceView);
//resize
FrameLayout.LayoutParams bgParams = (FrameLayout.LayoutParams) testSurfaceView.getLayoutParams();
//testcase full hd - working
bgParams.width = 1920;
//testcase 2 - working - each segment is 330px as 9900 / 1920 * 64 (default segment width) == 330
//bgParams.width = 9900;
//testcase 3 - working
//bgParams.width = 10000;
//testcase 4 - not working - each segment is 335px which is correct but first cell gets cropped by exactly 50px to the left
//bgParams.width = 10050;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
testSurfaceView.setX(0); //doesnt help
/*
Also the position counts into the 10000px limitation as you can see on following testcases
*/
/*
bgParams.width = 9900;
bgParams.height = (int)Math.floor(bgParams.width * (9d/16d)); //16:9
//works - as 9900 + 90 < 10000
testSurfaceView.setX(90);
//doesnt work, crops 50px to the left - 9900 + 150 -> 10050
testSurfaceView.setX(150);
*/
public class TestSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public TestSurfaceView(TestActivity context)
super(context);
SurfaceHolder holder = this.getHolder();
holder.addCallback(this);
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder)
//load bitmap from file
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/testimg.png", options);
Canvas c = surfaceHolder.lockCanvas();
Rect rect = new Rect();
rect.set(0,0, 1920, 1080); //image size
Rect destRect = new Rect();
destRect.set(0, 0, this.getWidth(), this.getHeight());
//draw the image on the surface
c.drawBitmap(bitmap, rect, destRect, null);
surfaceHolder.unlockCanvasAndPost(c);
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
@Override
public void surfaceDestroyed(SurfaceHolder holder)
styles.xml - for the theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
</resources>
The code above produces following output, which is correct.
If I change the bgParams.width
to 9600 - it scales up correctly and still displays starting from the left edge of the image:
But if I change the code to e.g. 10050, the image gets cropped by 50 pixels to the left.
If I set:
destRect.set(50, 0, this.getWidth(), this.getHeight());
It gets displayed correctly, but as I can't do that for the MediaPlayer and it's super weird, I'm trying to find a good solution.
I also tried setting the sizes directly on the SurfaceView and instead of changing the LayoutParams, I tried setting scaleX and scaleY of the Framelayout but ended up with the same results.
(btw. opengl max texture size is about 16000px - setting it above the ~16000px results in a black screen and an exception, so that is not the cause of the problem)
Update:
Posted all sources. Anyway here is the complete android studio project:
WeTransfer project download link
android surfaceview android-source android-7.0-nougat android-x86
android surfaceview android-source android-7.0-nougat android-x86
edited Mar 11 at 8:19
Daniel Ziegler
asked Jan 7 at 12:07
Daniel ZieglerDaniel Ziegler
588616
588616
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54
|
show 13 more comments
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54
|
show 13 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54074137%2fview-gets-cropped-above-10-000-pixel-width%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54074137%2fview-gets-cropped-above-10-000-pixel-width%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Removing the FrameLayout backgroundFrame and setting the SurfaceView as the contentview didnt solve the problem. Setting a simple ImageView as content and stretching that one > 10000 in width works, though.
– Daniel Ziegler
Jan 8 at 15:38
Can you post your test project (including the picture you use) so I can try to reproduce the problem without copy-pasting all the stuff?
– Divers
Jan 9 at 16:00
@Divers added the source files to the end of my post. The image (for others) is the first one in my post. In the source files the image is in the res folder res/raw/testimg.png. Also the SurfaceView code changed a bit to load the img from resource and not the file system
– Daniel Ziegler
Jan 10 at 7:29
Replace FrameLayout with some other layout like RelativeLayout or LinearLayout. This should fix the problem.
– Rishabh Sagar
Mar 8 at 12:22
@RishabhSagar Hey, tried both - both end up with the same result. Left-side cut off
– Daniel Ziegler
Mar 8 at 12:54