How To Make Background Image Fill And Fit The Screen
Oct 3, 2010
I've started learning about drawing things to the screen with Surface view and canvases, but I've run into a problem. At the moment, all I want to do is draw a background image to the screen, and have it fit the screen, regardless of size or resolution. I've figured out how to draw the image just fine, but it doesn't fit the screen at all.
Here is my situation: I'm developing on an Archos 5 internet tablet. It has a 4.8 inch screen and a resolution of 800x480 - putting it in the "Large" class of screens and "Medium" class of pixel density for Android. My background image is 800x480 - my thinking was that it would be displayed perfectly on my device, and scaled down on smaller screens.
But this isn't happening. When I place my image in the "medium" density drawables folder, the image seems "zoomed in" and I can't see it all on my device. And when I emulate the app with different screen sizes, it's all over the place.
I'm drawing my image in a Panel which extends Surface View. Here is the code:
Code:
package com.plant.drawing;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.content.Context;
[Code] ....
In my layout, I set this panel's properties of layout height and width to "wrap content." I'm really new to Surface views and the like, so I'm sure I'm simply not doing something - but what can I do to make this image fill the background of any size screen? The image is a .png, by the way.
View 3 Replies
Sep 20, 2010
When I play video on my Milestone it doesn't fill the screen. There is a small black border all the way around the picture. Does it on video recorded with device and with video loaded on SD. Anyway to make it fill the screen?
View 4 Replies
View Related
Aug 20, 2010
I have a layout that has just a ScrollView visible. It has a relative layout as its child. This layout has several other layouts (mainly text views) as its children. When the text is not big enough, the scroll view does not expand itself to fit the whole screen. Instead, it shows a gap at the bottom where the background shows. I tried setting fillViewPort=true on the ScrollView, but that just made the first child layout (RL1) to fill the screen.
CODE:....................
View 1 Replies
View Related
May 11, 2010
I'm new to android but I've been working my way through the tutoials. Still trying to get my head round layouts in a non-html world and was wondering how to achieve the following....
1) I'd like to set a tiled background to fill the screen behind the whole activity
2) I'd like to place a graphic and a button underneath it centred in the middle of the screen.
3) When the user clicks the button I'd like to start a new activity and presumably I have to do something to the current activity so the user can use the back button to get back to it.
View 1 Replies
View Related
Jul 20, 2010
I would like to set my own background in my preference screen, but the method I know doesn't work...
RelativeLayout
ImageView
PreferenceScreen
This just crashes my app.
View 9 Replies
View Related
Nov 15, 2010
I am trying to fill an image onto my screen, but it is just covering around 75-80% part of whole screen, not whole screen.
The codeblock i am using is as:
CODE:...........................
View 1 Replies
View Related
Apr 25, 2010
I have set a background image in my app, but the background image is small and I want it to be repeated and filled in the whole screen. What should I do
<Linear Layout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/bg" android:tile Mode="repeat">
View 2 Replies
View Related
Nov 21, 2010
I have the following in my main.xml the image marker does not fill the width of the device? code...
View 2 Replies
View Related
Jun 13, 2009
Does anyone know how to make a dialog fill the screen width in landscape mode? Setting the layout's width to fill_parent doesn't do it. It always comes up portrait width, or something suspiciously similar.
View 3 Replies
View Related
Feb 21, 2010
I can create and display a custom alert dialog just fine but even so I have android:layout_width/height="fill_parent" in the dialog xml it is only as big as the contents.
What I want is dialog that fills the entire screen except maybe a padding of 20 pixel.
Then the image that is part of the dialog would automatically stretch to the full dialog size with fill_parent.
View 1 Replies
View Related
May 6, 2010
I have a very small scratch on my screen after having this phone for 2days and I was wondering if there was a product to fill it in.
View 8 Replies
View Related
Aug 17, 2010
Ive been raking my brains trying to figure out how to play 720p movies on my HDTV in 16:9 aspect ratio (or 1.78), whereas it would fill the screen of the HDTV nicely just like Niko does it in this thread Video Demo: HTC Evo playback of HD/720p movies over HDMI out. I have a couple of 720p bluray movie files on my PC that i want to encode but now im not even really sure if they are really 720p. When i upload them into handbrake, it says that the source resolution is 1280x544 and the other one 1280x528 with a 2.35 aspect ratio. Doesnt the second number have to be 720 in order to be considered true 720p HD resolution? Everytime i try and change the 528 to 720 on hanbrake, it doesnt let me. And also handbrake doesnt havent an option where you can change the aspect ratio. When i finish encoding, i get the stupid black bars. i realize the video file might have been shot in a 2.35 aspect ratio or whatever but when i play it in VLC it allows me to change it to 16:9. Basically, I want the video to come out in 1280x720, 16:9, 1.78 resolution and aspect ratio as its default settings. This would be much easier if VLC was playable on Android. At the end of the day, im just trying to find out how to watch 720p video on the HDTV in fullscreen or almost fullscreen (i know theres a couple of inches of black bars in 16:9) just like the guy in the thread above.
View 9 Replies
View Related
Jul 31, 2009
My dialog shows a relativelayout, which is set to fill_parent in both width and height. However, it doesn't fill the whole screen. I tried settting the window flags to full screen but that didn't help either. Can someone tell me how to do this?
View 5 Replies
View Related
Mar 24, 2010
I'm developing an Activity with a simple LinearLayout with a button. When I try the activity on my hardware (WVGA 480x800 screen) the activity only fills the standard size (480x320) while the OS itself fills the whole screen.
What could be the issue.
CODE:..................
View 1 Replies
View Related
Dec 14, 2009
Any idea why this doesn't create an activity that looks like a popup instead of an activity that completely fills the screen?
CODE:.............
I assumed that I only needed to set the layout height and layout width to something other than "fill_parent", but it still shows up as a black screen that completely fills the screen.
Ultimately, I simply want to create a popup, but I do not want to use an AlertDialog. Is this possible?
View 2 Replies
View Related
Mar 6, 2010
I'm battling with Android's retarded layout system. I'm trying to get a table to fill the screen (simple right?) but it's ridiculously hard.
I got it to work somehow in XML like this:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent">
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1">
<Button android:text="A" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/>
<Button android:text="B" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/>
</TableRow>
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1">
<Button android:text="C" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/>
<Button android:text="D" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/>
</TableRow>
However I can not get it to work in Java. I've tried a million combinations of the LayoutParams, but nothing ever works. This is the best result I have which only fills the width of the screen, not the height:
table = new TableLayout(this);
// Java. You suck.
TableLayout.LayoutParams lp = new TableLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
table.setLayoutParams(lp); // This line has no effect! WHYYYY?!
table.setStretchAllColumns(true);
for (int r = 0; r < 2; ++r)
{
TableRow row = new TableRow(this);
for (int c = 0; c < 2; ++c)
{
Button btn = new Button(this);
btn.setText("A");
row.addView(btn);
}
table.addView(row);}
View 3 Replies
View Related
Feb 2, 2009
Let's say I want to make a layout that has 3 TextViews, one on top of the other. But, I want the top TextView to always "stick" to the top of the screen (regardless of orientation), and I want the bottom TextView to always "stick" to the bottom of the screen. Then I want the middle TextView to always fill the available space in between (again, regardless of screen orientation). I've had no luck with LinearLayout and I've come close with RelativeLayout but neither have provided by desired solution.
View 3 Replies
View Related
Sep 20, 2010
I noticed that the red zone games do not fill the whole screen. Is this normal?
View 4 Replies
View Related
Feb 28, 2010
Having this XML view code...
Why my ListView shows only the first item and does not fill the screen?
View 1 Replies
View Related
Oct 19, 2010
In my android application on click of image i would like to display a page which could provide a notepad facility to user. I placed a edit text with fill parent but the cursor starts from the middle of the screen.
Is there any way that i can start the cursor from the beginning.
View 1 Replies
View Related
Sep 1, 2009
I am using an activity with the dialog theme set, and I want it to be full screen. I tried all sorts of things, even going through the WindowManager to expand the window to full width and height manually, but nothing works. Apparently, a dialog window (or an activity with the dialog theme) will only expand according to its contents, but even that doesn't always work. For instance, I show a progress bar circle which has width and height set to FILL_PARENT (so does its layout container), but still, the dialog wraps around the much smaller progress bar instead of filling the screen. There must be a way of displaying something small inside a dialog window but have it expand to full screen size without its content resizing as well?
View 2 Replies
View Related
Feb 5, 2010
hi all proud parent of a newborn eris here. was wondering if there is a way to enlarge a contact photo for the screen when that contact is calling you?
View 1 Replies
View Related
Jul 8, 2010
How can I fill the screen with 2 horizontal colors, such that the down one will get 10% of the screen? (like a toolbar)?
I'm trying modify the Linear Layout example to Code...
on the down "panel"(is it a panel?) the text is not shown complete.
View 1 Replies
View Related
May 11, 2010
How can I create 3 equally wide TextView which fill parent across the screen? I tried doing this, but the width of the TextView are different: it is 149, 89, 89.
CODE:...................
View 1 Replies
View Related
Nov 18, 2009
I'm new to Android,but I've had smartphones.I've had an iphone and win mobile phones. I'm not sure I'm understanding how to import video to the droid. I tried just making a folder on the sd card and pasting a video(mp4) in it, but the droid doesn't recognize it.Then i used Motorola media link, it worked, but the picture quality didn't seem as sharp on the droid than it did on the iphone(didn't compress it when i transferred) and can't seem to figure out how to expand video to fill screen.
View 1 Replies
View Related
Apr 18, 2010
Let me know how to set up a background image in opengl. You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
View 5 Replies
View Related
Oct 29, 2009
ListView Question! I know it's possible change the row color, but it's possible to put some imagem on background? And if yes, it's possible to create an imagem 1px and repeat-x or repeat-y like CSS?
View 2 Replies
View Related
Mar 29, 2010
I want have an image and i want to set it as a background of android list view. i have used android:background="drawable/image" but nothing happened. how to achieve this?
View 1 Replies
View Related
Apr 28, 2010
I am developing a live Wallpaper on android 2.1
I want to set in background a bitmap that i download on a server. I use canvas with the method setBitmap(Bitmap bitmap); but it don't work. I also try to set it in an ImageView in a different class of my live Wallpaper but it also don't work.
Have you got a solution?
View 2 Replies
View Related
Oct 2, 2010
I have a background image about 100 x 100 that I want to center in an Android app. Is there a way to do this?
I'm thinking it would greatly help with orientation changes for simple apps.
View 1 Replies
View Related