Coding a webpage so Android doesn't show the sidebar - Hero, G2 Touch Android Development

Does anyone have any idea how to code a webpage so that the sidebar doesn't show in Android's browser? Usually when writing a page for Firefox/IE etc you'd include overflow: hidden; in the CSS and the overflow/sidebars would be gone but this doesn't work in Android's browser.
Any suggestions?

What is the sidebar? Maybe set the width of the page to 320 pixels...?

View a webpage with a background that isn't white and you'll see the sidebar. Changing the page size to match the screen resolution has no effect.

Try this meta tag:
Code:
<meta name="viewport" content="minimum-scale=1.0, width=device-width, maximum-scale=1">
It works on the iphone. If not try setting the width to just under the screen width, say 318px in the body tag.

I can't get that to work either. Basically I need a plain black background that I can put some content on top of but nothing I try gets rid of that damn sidebar!

In your CSS try:
Code:
body {
width: 315px;
}
#browser{
width: 315px;
overflow: hidden;
}

if you are using ASP.NET you could try using masterpages with different layout styles and dynamically set them depending on the browser used by the client.

Related

How To: Customize the Sliding Panels Homescreen

This was from the windows mobile team blog. More to follow but wanted to post it for those who don't read that.
Original link: http://blogs.msdn.com/windowsmobile/archive/2008/06/03/customizing-the-sliding-panel-homescreen.aspx
Customizing the Sliding Panel Homescreen
from Windows Mobile Team Blog by Jorge Peraza
Hi, my name is Jorge Peraza; I am a Developer on the Windows Mobile team that was responsible for the new “Sliding Panel” home screen in Windows Mobile 6.1.
When we were working on the visual style and functionality of the home screen we tried to make something that looked both professional and appealing while still showcasing all the information the user is going to need to know what’s important and requires attention. While I think the default design looks really cool, we added some customization features to enable users to make it their own.
Customizing the layout
The home screen layout can be modified using the same home.xml file from previous versions of WM, the schema of the file was extended to allow the customization of many of its elements, this includes the art assets that are used for most of the plug-ins.
When you open the SlidingPanel.home.xml file (inside \ApplicationData\Home) you will find the plug-in element that corresponds to the sliding panel home screen (its CLSID is {E9267CAB-02EE-4f37-8216-6BF6A8FF5A71}). All the child elements inside it are designed to tweak and customize the way the home screen will look.
The top level element is the plugins tag, this has one attribute called “Order” and it’s used to list the plug-ins that will be shown and the order they are going to be laid out on the screen.
The built in plug-in names are:
1)CClock – The big clock
2)CAppointments - The calendar plugin
3)CHome – The notifications plugin
4)CMyPhotos – The photos plugin
5)CMessage – The message center (this is off by default on all sliding panel built in layouts.
6)CMusic – The music plugin
7)Settings – The settings plug-in
8)Custom Plugin – Users can specify custom plug-ins with static content that can be displayed on the home screen.
For example, the XML snippet bellow moves the photos plug-in to the first position and enables the message center (which is turned off by default on both "Sliding Panel" and "Sliding Panel Media")
<plugin clsid="{E9267CAB-02EE-4f37-8216-6BF6A8FF5A71}" name="Bronze" height="266">
<Plugins Order="CMyPhotos;CClock;CMessage" />
</plugin>
There are many other ways of customizing the home screen using the plug-in settings like overriding the default images or even adding your own custom plug-ins that display static content, I'll post and updated entry latter on on how to do this in detail but for now, you can use the provided home.xml files to start experimenting with this.
The notifications plug-in and message center
In the sliding panel home screen, the notifications plug-in by default serves as a dual-purpose notifications/gateway to all you phone/message accounts where every page represents one account (so, if you have multiple notifications in one category they will be shown as one summary page).
There is however an alternative behavior where individual notifications are added as independent pages (Similar to what the T-Mobile shadow home screen does) and the plug-in only shows accounts that have new notifications in them. One cool feature of this alternate behavior is that each individual notification can be dismissed without having to leave the home screen.
You can enable this alternative behavior by setting the following registry key to a value other than 2 (The actual value indicates how many pages of each notification type will be added to the home screen before collapsing them into a summary page. We have tested 2 and 5 but feel free to experiment with other values)
[HKLM\Software\Microsoft\Chome\Chome]
PageCollapseThreshold: DWORD
Note that this prevents you from being able to access the email/phone account data if there are no notifications for it. If you still want to be able to do that you can always re-enable the message center as described in the previous section as a separate plug-in.
There is one more behavioral change you can make that allows you to “dock” the condensed view of the first plug-in to the top of the screen when it is not active, we added this for people like me that want to have the clock always visible. To enable just set the following registry key to “1”
[HKLM\Software\Microsoft\Chome]
DockOperatorBar: DWORD
Advanced layout modification
There are even more advanced things you can do to further tweak the look of the home screen but it is unsupported by Microsoft at this moment so you’ll have to experiment on your own J (Hint, look at the following files \windows\CHome_240x320.cpr and \windows\CHome_320x240.cpr).
----------------------------------------------------------------------------------------------------
Thanks to djNutz for posting this information & OrganicM for his efforts.
I wanted to create a post with info about what the different keys do in the CHome section of the registry. So, I'll start with a brand new one, that I bet nobody knows about....
[HKLM\Software\Microsoft\Chome\Chome]
PageCollapseThreshold: 2 or 5 (DWORD Value)
This will collapse your Notifications panel to only show active notifications. You can enable this alternative behavior by setting the following registry key to a value other than 2 (The actual value indicates how many pages of each notification type will be added to the home screen before collapsing them into a summary page. 2 and 5 were tested and work pretty well.
More to come of course....
should this change be made to the security section too, or does that matter? actually, do changes to the security section ever matter, cause they seem to apply even when you only edit the software section.
p.s.
i'm pretty sure people are gonna ask, so maybe i'll save some trouble instead of looking like an ass by answering preemptively. This DWORD value must be created with your registry editor, it's not already there, at least on ricky v24.
2 = default or normal (i assume cause it looks the same as before) and 5 = condensed.
But for the rest of us who don't have the time to be on every WM blog and forum at once here's my favorite:
To “dock” the condensed view of the first plug-in to the top of the screen when it is not active, set the following registry key to “1”
[HKLM\Software\Microsoft\Chome]
DockOperatorBar: DWORD
This is so you can have the clock always visible, no matter which panel you're on. You could also set it so that CHome Weather's compact view is always on top. Whatever plugin is first on the list.
More info from MS coming down the pipe:
We can get the day of the week on the clock plugin at the top of CHome by doing this:
Replace this portion...
<!-- Date --> <Text ID="Date" Left="180" Top="83" Width="110" Height="19" FontFamily="Segoe Condensed" FontSize="9" FontStyle="Bold" Wrap="False" HorizontalAlignment="Left" Trimming="EllipsisCharacter"></Text>
With this!
<!-- Date -->
<Text ID="Date" Left="180" Top="83" Width="110" Height="19" FontFamily="Segoe Condensed" FontSize="9" FontStyle="Bold" Wrap="False" HorizontalAlignment="Left" Trimming="EllipsisCharacter"></Text>
<Text ID="Day of Week" Left="65" Top="83" Width="110" Height="19" FontFamily="Segoe Condensed" FontSize="9" FontStyle="Bold" Wrap="False" HorizontalAlignment="Right" Trimming="EllipsisCharacter"></Text>
I will incorporate this in Chome Weather fore sure!
Here you go, the first is my Home
2nd is Scroll Down once
3rd is Scroll Down twice
4th is Scroll Down Thrice
heh
Edit: Tried Month in cpr, no luck.
will keep trying
I'm glad people are finally getting this information out. It makes customization that much easier. I'm adding the tips to the wiki as well, as they come out.
How to Reload the Homescreen
I have two questions:
1. After editing my CHome cpr file, how do I reload the homescreen without having to reboot the device?
2. How can I show any text on the clock panel? Regular text is defined by Text ID = "xxxxx", where xxxxx is something like Time, Network Name, etc. However, suppose I want to have the text "Knowledge Rules", how do I set it up in XML?
I have very little programming and Excalibur experience. So, I apologize if these questions are too naive or have been answered before.
Thanks a lot in advance.
you can use this if you dont use OrganicM Chome Weather
I don't think Microsoft has put out much documentation on the sliding panels plugin yet. Most of the CHome configurations use
Code:
TextID="text 1"
as the delimiter for static text. But that's not to say that the clock plugin will recognize that as a valid section. Could work. Could make your phone useless.
beartard said:
I don't think Microsoft has put out much documentation on the sliding panels plugin yet. Most of the CHome configurations use
Code:
TextID="text 1"
as the delimiter for static text. But that's not to say that the clock plugin will recognize that as a valid section. Could work. Could make your phone useless.
Click to expand...
Click to collapse
I do not understand. How do I make the phone know that:
text 1 = Knowledge Rules?
Typical syntax seems to be Text ID = "xxxx", where xxxx is a variable name, which is recognized by the device. If Text 1 is a valid variable for the device, how do I assign it a value? Am I rambling here?
No, you're not rambling. As far as the information coming from Microsoft and disseminated here on this site goes, it's a best guess right now.
someone at msdn blog asked the same question.
Someone at msdn blog asked the same question. Let's wait to see if we get an answer from there...
From http://blogs.msdn.com/windowsmobile...ustomizing-the-sliding-panel-homescreen.aspx:
"Jorgeba, thanks for taking the time to educate your user. I have some questions.
How do you change the text in the condense clock? The .cpr file has Text ID="Text 1". How is "Text 1" define? I would love to add the date to the condense layout.
The ActionURL and Softkey2 URL in the Appointments plug-in always open calendar in the today view. Is there a way to make one of the button opens calendar in the month view? Setting the default view for calendar does not help."
Easy as pie......
If you know what you are doing.
If you have any xml experience,then you'll know how to adjust x and y values to position things in different places. Yes, you can do that. Just change x=whatever and y=whatever to where you would like them to be. Just know this means that it will start on the left and move x pixels over and y pixels down. If you put in negative values, it will shift them in the opposite direction.
Eg. x=-whatever will move it to the left vs a + value which will move it to the right. Same for y=
Also, you can adjust the valignment and halignment to center, left, or right.
Have fun with these. They apply to everything in your cpr (That's the layout for your homescreen.It's in your \Windows directory on your phone).I mean everything, from where your network displays, right down to your pictures.
That's it. Have fun!
jaymit said:
Hi,
Sorry Im kind of a newbie :s, is it possible to edit home screen panels? I wanted to change the layout and look of the clock plugin.
Thanks!
Click to expand...
Click to collapse
Does anybody know how to change font color for certain panels or certain lines of text in the panel? Is it only possible for the whole homescreen?
As far as I know even as far as old xml coding works, you can only change a font color for a selected word or unselected word. Meaning, if you have the old 6.0 your plugins that are selected could have a different color, but unselected could be another color. This applied to the entire homescreen. I have not seen different colors for different plugins, since each panel style is basically its own plugin (each has its own unique GUID), then I doubt you can change font color for each plugin. You can more than likely only change the active selected panel and inactive panel fonts. I am not sure what their titles are in the cpr, but I know that in the old 6.0, the homecolor was one of the fonts colors and the other was called something else.
Eventhough this is 6.1, it doesn't look like much has changed as far as the fonts color goes. You could, however, always try adding a "fontcolor=" command in the cpr and a hex code and try it, to see if it works.
Hope this helps.
Edit your registry or get CHome Config
Both do the same thing. You want to change the plugin order for CHome. It's located in HKLM\Security\CHome\Default Settings and in HKLM\SOFTWARE\Microsoft\CHome. Edit the order you want your plugins to go. Reboot your phone and the new edits should be reflected in your homescreen layout. If you are having trouble cause this is new. Just search this thread for CHome Configurator. It's stickied at the top of this forum. Download it and it will let you select the order in a much easier way. Make sure you reboot, though, or else your changes won't show. Hope this fixes your problem. Later.
tae-xda said:
How to change the default location for where the CMyPhotos plugin
Click to expand...
Click to collapse
rollingondubs1 said:
I have that already, All my games are under a folder which i cant make it as a action url
Click to expand...
Click to collapse
try this
"ACTIONURL" = "\Windows\Start Menu\Games\xxxxx xxxx.lnk
or this
"ACTIONURL" = "\windows\fexplore.exe; \windows\start menu\games"
Yes you can
One last time, I think I've figured out how to help you.
1. Open Chome Config.
2. Scroll to MyApplication and select it with your center button.
3. Scroll to any page you want to edit. Then scroll down to where it says ActionURL. Press menu.
4. Once in the menu select the "1 Change URL" item.
5. Once you have selected that it will take you to a file explorer. Go to \Windows\Start Menu\Games. This is where your games should be. If not, then wherever you store, your games, navigate yourself to that folder and select the file you want.
I think this should cover it. Hope this solved your problem. HOLLA!!!!
rollingondubs1 said:
I have that already, All my games are under a folder which i cant make it as a action url
Click to expand...
Click to collapse
How to change the location of CMyPhoto to \Storage Card\My Documents\My Picturs

Registry entry for changing scroll bar size.

Can someone point me to the info regarding the registry entry for making the scroll bars thinner. I have looked every where and searched for scroll bars.. cant find it.
got it.
had to sneak over to the q forum.
here it is.
1. Making the scrollbars smaller (Vert. and Horz.)
This hack allows 4 icons on a row in the start menu instead of 3 and allows more to be viewed on the screen in IE:
• Go to: HKey_LOCAL_MACHINE\SYSTEM\GWE\
• Adjust the following values
cyHScr : Horizontal Scrollbars
Height in pixels (default is 6, set it to 3)
cxVScr : Vertical Scrollbars
Width in pixels (default is 6, set it to 3)
• Soft-reset
Its mostly nicer for web browsing.
also this asks for you to create them, they are allready created.
Bump for a good change that I felt was missing from the new roms. Thought others would appreciate it.

question regarding visual basic 2008(need help)

my problem is that i cant get image loaded in picturebox transparent.
i create picturebox, select image(png with transparent background) , in properties of picturebox i set background to transparent but it just shows white background where it shoud be transparent.
here are 2 imgs. first from designer where everything is ok and other from emulator wich showes that white background. please help!!!!
Search in the settings you need to PictureBox in the Program in which you create applications.
There is no such thing as setting the background ... at least in VS
so there is no way to have rounded buttons in vb or there is??
standard controls dont support transparency, so you're left with 2 options:
- set form backcolor = image backcolor
- create your own controls that support transparency. Here's a starting point: http://msdn.microsoft.com/en-us/library/dd630622.aspx. I did that in my own app and it is horribly time-consuming, but it works great

Size of Form

Hello,
i have an application, programmed in C#. I wanna that the size of the gui will automatically adapt to the size of the phone on which the application get used.
How can I do this?
In the Paint() event of the form examine its ClientSize property. This is the size of the client (White) area of the screen. It is itself a Size object with Height and Width integer properties, this.ClientSize.Width and this.ClientSize.Height
Use these values to position/resize your objects on the screen, by changing their Size and Location (Left and Top) properties, so that they fit in this area.
This event occurs before the Paint() event of the child objects, so they will be repositioned/resized before they themselves are drawn.
To be clever, reposition and resize screen objects, scaled to the screen size at run time, not values hardcoded at development time.
This technique can also detect a change of orientation, the values of Height and Width change over! If you want to be smart, handle this as well, and your app should be starting look pretty damned professional. A bit of work and it should look good on all screen sizes. Test them out against the SDK's emulator images for a range of device screen sizes.
The following code example positions the label in the correct place. Hey Diddle Diddle, slap bang in the middle!
Code:
private void Form1_Paint(object sender, PaintEventArgs e)
{
label1.Left = (this.ClientSize.Width - label1.Size.Width) / 2;
label1.Top = (this.ClientSize.Height - label1.Size.Height) / 2;
label1.Text = this.ClientSize.Width.ToString() + " x " + this.ClientSize.Height.ToString();
}
do you have to do this with every object you put on it? Seems like a lot of code. (also im doing this in VB so far..)
I'm afraid so. But it's worth the effort. Also it will run on all screen sizes, see image, and also the oddball ones they haven't thought of yet!
Change 'this.' to 'me.' and omit the C# end of line character ';' and it's now in VB.
Does your form property AutoScaleMode is set to AutoScaleMode.Dpi?
For controls set the anchor property (default is top|left) also to right (and/or bottom if needed). That will automatically 'stretch' the controls.
Advanced:
Now, if you really want to support different resolutions it will take much more work:
As already mentioned you have to rearrange the controls on orientation changes. Take a look at Developing Orientation and dpi Aware Applications for the .NET Compact Framework!
And finally you have to provide images in different resolutions.
Adapt to New Screen Orientations and Resolutions
Of course you have to decide if this is really needed for your app as this will take much more time.

How to get smooth graphics (no jaggies)?

Hi
I built a simple clock app yesterday. It was surprisingly easy. One question I have though is how to make my images smooth (without jaggies). I drew my clock face and hands in photoshop. At first I did them at 300x300 pixels and the jaggies were so obnoxious I threw those images away. Then I did everything at 1000 x 1000 pixels and resized down to 300 when I was finished. This was much better, but still not as smooth as the clock in Jelly Bean. I notice that most of the graphics and fonts I see in Android are all very smooth. I've been testing the app on a Galaxy Nexus.
What is the secret to creating/displaying nice smooth images?
Thanks, Derek
vector graphic is the keyword with fix sized effects (photoshop, ie. inner shadow is always 1px, above 256px use 2px)... yeah, the simple bitmap resizing won't give pro result for you
Heh Yeah, I've had this problem and it was a ***** to solve. Mainly because the answer is distributed over a dozen different posts on half a dozen different forums.
Anyway, the answer depends mainly on if you're using imageviews/buttons or something or if you're drawing directly to a/your own canvas. But the way to solve it can be applied to both. It basically involves using BitmapFactory.Options and configuring it correctly:
Code:
private BitmapFactory.Options ops;
ops = new BitmapFactory.Options();
ops.inPurgeable = true; //means the system can recycle and reclaim the memory used by the bmp when the system has low memory
ops.inDensity = 0; //load the bitmap without scaling it to the screen density
ops.inDither = false; //don't dither (you only want dithering when you're working/converting between bitmaps/canvasses with different color depths (16bit to 8 bit etc)
ops.inScaled = false; //no scaling, related to some other settings in ops
ops.inPreferredConfig = Bitmap.Config.ARGB_8888; //load the bmp into a 32bit argb bitmap
ops.inJustDecodeBounds = false; //if true, you're just looking at the underlying bmp data, eg to see the height/width without loading the bmp into memory
//then load your bitmap like so:
Bitmap yourbitmap = BitmapFactory.decodeResource(getResources(), R.drawable.yourprettybmp, ops);
Now you can use the bitmap to draw onto all kinds of surfaces or load it into widgets.
Be warned, this is a non-mutable bitmap. If you want to change it's data (like you want to draw on it by making it the backing bmp of a canvas) you'll have to get a copy of the BMPFactory.decodeResouce bit by adding
Code:
.copy(Config.ARGB_8888, true);
to it.
For resizing the bmp, you can also do the following (which returns a mutable bmp, so you won't need the copy bit above):
Code:
yourresizedbmp = Bitmap.createScaledBitmap(yourbmp, width, height, true);
Of course, you can combine all this in one step (where "res" is a reference to getResources()):
Code:
yourresizedbmp = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(res, bgIDInt, ops), width, height, true);
One more thing to ensure quick drawing, lower memory usage etc is to define the window type of your activity to match the colour depth of your bitmaps. You can do that by adding the following to the onCreate of your activity:
Code:
getWindow().setFormat(PixelFormat.RGBA_8888);
And if you're also drawing to a surface canvas in a thread, you also set that:
Code:
mSurfaceHolder.setFormat(PixelFormat.RGBA_8888);
Anyway, the most important thing is the "ops" section. Hope you get it sorted!
PS: clean, minimal graphics can often be more easily gotten by just drawing things yourself on a canvas (extend the View object and override it's onDraw()). Just use a correctly setup and antialiased Paint to draw circles, lines and text on it and use the result.
Bitmaps are not generally used for graphics. Try to use PNG images, Google does so too.
I might be wrong, but from the OP it seems like you're using the same image size for all resolutions, use the Android Dpi Calculator to easily get the right dimensions for each screen resolution (and put the resized images respectively in /res/drawable-xhdi, hdpi, mdpi, ldpi...)
If you didn't do so, then it's definitely the problem as mdpi is the default behaviour of /res/drawable, so it will be awfully resized on your xhdpi Galaxy Nexus.
dealy663 said:
Hi
I built a simple clock app yesterday. It was surprisingly easy. One question I have though is how to make my images smooth (without jaggies). I drew my clock face and hands in photoshop. At first I did them at 300x300 pixels and the jaggies were so obnoxious I threw those images away. Then I did everything at 1000 x 1000 pixels and resized down to 300 when I was finished. This was much better, but still not as smooth as the clock in Jelly Bean. I notice that most of the graphics and fonts I see in Android are all very smooth. I've been testing the app on a Galaxy Nexus.
What is the secret to creating/displaying nice smooth images?
Thanks, Derek
Click to expand...
Click to collapse
Not sure if you've fixed this already but it's really easy. No code is required to remove jaggies, regardless of resolution. Assuming you're using Photoshop, choose save for web and devices, then select PNG-24 (not jpg or PNG-8) with transparency enabled. Initial resolutions of 200x200, 300x300 etc. are all fine; there's no need to create it at 1000x1000 and scale down if you need something smaller. Your graphics will look great.
One more tip - clock widgets fill a certain number of "squares" on the home screen grid, so just make sure that you determine the right number of dp pixels to cover the size you want (e.g., 2x2 or 2x4, or 3x3) and then specify it in xml. See the Android site for widget sizing.

Categories

Resources