Android :: Orientation Changes For Layouts
Oct 16, 2009
i have a layout folder with 2 layouts. layout1 and layout2 i have another folder layout-land that has layout1 in it. i would like to be able to get to all the layouts so i could create a set of layout like this: {layout1, layout2, layout1(from layout-land folder)}is there any way i can use the existing android mechanisim to do that? if not, what would be the impact of creating my own definition of the layout folder (for example to have under the layout folder layout1, layout2 and layout_land1 and have my code do getOrientation to diffrentiate whcih one should be presented).
View 9 Replies
Sep 6, 2010
I'm creating a game where there's a screen that, for the most part, is shared by four different activites - but a key portion of the screen will be completely different, depending upon which activity is active. Basically, on the left will be an image of the player and along the bottom there will be a row of buttons (let's say for Armour, Weapons, Magic, Skills). This leaves the top-right portion, which will need to dynamically change to represent the button pressed. (So, one moment the top-right portion is the armour selection activity, and the next it's the weapon selection activity, and so on.)
Is this possible? Can I have a layout within a layout and dynamically point the nested layout at a (nested) layout.xml of my choosing? Or, am I looking at just duplicating most of the layout four times (for the four different activities?) Or, am I going to be looking at linking the four activities to a (the top-right) view component, and then having to dynamically construct all of *that* view's child views based on the currently active activity? Well, that's about as much sense as I can make this question make.
View 4 Replies
View Related
May 14, 2009
I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.
Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).
After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?
View 3 Replies
View Related
Aug 19, 2010
I understand how to force a specific orientation per activity in the android manifest. I would like to know if it is possible to allow the keyboard to change orientation even though the activity(the layout really) must remain unchanged.
View 1 Replies
View Related
Jul 17, 2009
I have a problem with working with the ORIENTATION values of the SensorManager. I would like to have some kind of 360°-value which directly shows me if the phone is in normal portrait (0°), landscape, portrait turned around (180°) or anything in between. So I could have, for example, an arrow that points to the floor (like gravity would do with a plummet) all the time, no matter how I tilt (sidewards) the phone. I thought this would be easy, but I'm pretty confused at the moment.
First of all, the X value of the orientation-array seems to correspondent with how I turn the phone, BUT: if it's completely uprightly standing, this value is about 60° ... why not 0° (or 90°, 180°, 270°), as I would expect?
Second: The value resets if I turn the phone and Android automatically changes screen orientation. So both in Portrait and in Landscape mode it will be sth. like 60° when the phone is in a 0° angel in real world. I set "android:screenOrientation" to "landscape" but this doesn't help anything :/
I want the app NOT to change orientation when I turn the phone, but I want it to get a continuous orientation value when I tilt the phone.
View 4 Replies
View Related
Sep 21, 2010
If I first set the content view to my xml layout using setContentView(R.layout.main); and then add another content view using addContentView(layout, params), the content views overlap each other. I want the second content view to position itself directly under the first one. Is it possible or do I need to combine the xml and the programatically created layouts in some way? Both of the layouts are linear.
View 1 Replies
View Related
Aug 31, 2010
while making my application layout i want a button to remain at the very bottom of the screen while a scroll view is placed above it. I am unable to do this i was using the size of the scroll view as 430dp so that it works but when i change the orientation of the screen this does not work as 400dp is bigger than the screen. how do i make it so that the button stays at the bottom irresepective of the screen orientation ?
View 3 Replies
View Related
Apr 26, 2009
I'd like to build an activity that is mixing layouts with 2D graphics. So for example, would like to introduce an edittext with an integer value and based on that value the size of a circle is dynamically adjusted and drawn. Any idea how to do this?
For plain graphics I am using this approach here - but how can it be expanded to cover Android layouts (buttons, editboxes, textviews, radiobuttons, etc.)?
CODE:..............
View 2 Replies
View Related
Nov 18, 2010
Is it possible to create subfolders under res/layout and place the layout XML files there so that one can call a view like setContentView(R.layout.questions.create); or setContentView(R.layout.questions/create); ?
View 1 Replies
View Related
Aug 10, 2009
I've met a problem with animation when tried to make a View to perform the animation which should cross 2 layouts, e.g. make a translate animation so a view could move down to the TableRow below. This trick works fine when i try to move a view within a single TableRow but not when i try to move it up or down. I've also discovered that if i create a single RelativeLayout and apply the same animation there, it works fine, but i can't arrange all the components i need on the screen. Could anybody please provide me any hints about it?
View 2 Replies
View Related
Apr 27, 2010
supporting multiple screens (sizes and resolutions). I´ve searched not only this forum but many different websites and the android documentation but I´m probably doing a small mistake so things are not working properly.
Well, my main layout was designed with a HVGA screen, and it works great. When I try the same app on a WVGA, FWVGA, WQVGA or FWQVGA, I always get an unused space in the end of the layout because the screen ´s "heightnes" is proportionally bigger than HVGA´s.
So I consulted the documentation and decided to give a try on resource qualifiers, so I then created a nonsense UI and placed it on layout- large, created a new AVD using the WVGA skin and launched the app. Well, all I got was my old and not well stretched layout. The same happened to a FWVGA AVD.
This is the first problem. The second is: medium high density medium size screens and medium density large screens have the same resolution: how can I create a layout that is loaded for both, but not for (for example) medium size medium density or small size medium density screens?
View 10 Replies
View Related
Aug 13, 2009
I want to make a listview that has different rows (layouts). I will load the data from a webservice and it can be 2 or more layouts i have to generate then. I am creating a social network app and want to show a stream of the users activity. So when he made a comment, make a new friend, this all has to come in the same list.. I load 1 XML file with multiple different child objects (comment, friend) so i can see which layout i have to use........
View 5 Replies
View Related
Sep 28, 2009
i'm running into some issues inflating layouts and i wonder whether i have something basic wrong.i have a ListView with a custom adapter etc, and of course the item View is custom too. i've been creating the item View in code, and everything works fine, including recycling them and all that. great.but i want to move the View into a resource, where all good Android views live, and weirdness is happening.in the ListView's getView(), i get my inflater and inflate the view by ID. the view itself has its own XML file. i can inflate the top view, but i can't find anything by ID, and when asked for its children, nothing comes back.are there funky rules for inflating views this way? is there a convention for how this should be done inside a ListView?
View 11 Replies
View Related
Jul 27, 2010
Is it possible to load my main.xml layout file in onCreate() and then later in the app, switch to a new XML layout? I've tried placing setContentView() later on in the app but that seems to not actually set the new View because my references to objects in the newly set xml layout file are returning as null. I've tried doing some layout inflating using the LayoutInflater but I'm having no luck (I'm probably doing something wrong)... So is there any other way to swap layout xml layouts at runtime?
View 3 Replies
View Related
Mar 24, 2009
Is it possible to localize layouts (in the same way you can have a 'por' and a 'land' layout? As you may know some languages are less 'verbose' than others, thus sometimes layout adjustments might be needed according to the current language.
View 4 Replies
View Related
Oct 21, 2010
I'm wondering if it is possible to inflate a layout using a different density value than the default system density. I have a high density layout, which looks good on the Galaxy Tab (1024x600px, hdpi) and I like to use the same layout on another tablet with the same pixel resolution but medium density. The mdpi layout which is used works on the device but the screen just looks really empty and I would prefer to scale things up. So is there a xml argument for scaling the layout, maybe something similar to Bitmap.Options.targetDensity. Or could this be done with a new LayoutInflater class?
View 6 Replies
View Related
Oct 14, 2010
I have a relative layout which contain 2 arrows after that i kept sliding drawer.when i press on slidingdrawer its coming only upto relativelayout.it has to occupy entire screen.
View 1 Replies
View Related
Dec 3, 2009
I am getting my feet wet developing software for the Android. My test app will have multiple screens (each having their own layout file). The main screen will direct the user to view the other screens based on user input. I kinda see this as layers of cake. Bottom layer being main; then you add and remove layers as the user makes UI inputs. The crazy trouble is how to view a second layer. I have created a second class which has its own onCreate method, which has its on setContentView(R.layout.secondlayer).
This class extends Activity much like my primary class does. I have a click event on a button within the main layout. This button will instantiate the new second layer class which I have done. And that is where my story endsI don't know what to do from this point. This is surely a newbie question If someone has an example that would be extremely helpful teach me to fish and I will be on my way.
View 6 Replies
View Related
Aug 27, 2009
Where in the source are the layouts for the built-in UI's?I would like to reuse (copy) a couple of the contact UI's rather than recreate the wheel.
View 4 Replies
View Related
Jun 1, 2010
I am trying to create an app for android 1.5 which would be organized around 4-5 'screen's that will be changing in a given order.
So I start ma app with the first screen, which it's background and a button. When I click on the button a new screen appears with a different background and different options which lead to next screens. Sth. that is usually seen in games. The problem is that I need to pass a lot of data between those 'screens' like and array with recorded sound. My idea was to create a separate xml layout file for each screen and change the context in the activity class so ie:
CODE:............
A simple test app for 3 screens works this way but my I don't really like this approach and it seems to be inappropriate.
Is this the correct way of organizing such an app in android or should I take another approach - if I should, please give a more detailed advice on how to do this.
View 5 Replies
View Related
Dec 16, 2009
I have created layout-large and testing against android 2.0.1 WVGA. however, its picking layout-normal. Can anybody suggest me what I am doing wrong. Even though, I have 3 layouts ( layout-normal, layout-large, layout- small), Its always picking layout-normal. why its so.
I added properties to manifest file
CODE:.............
View 2 Replies
View Related
Aug 22, 2009
I'm beginning in android development, and I've stumbled upon a problem. My application has different layouts stored in xml files, and I use motion events such as onFling or onSingleTapup. These motion events seem to apply whatever layout i'm in. My problem is simply identifying which layout i'm currently using so I can define the appropriate action. I guess what i'm trying to do is a bit like this:
@Override public boolean onSingleTapUp(MotionEvent e) { if(using main layout) { //do this } else if (using settings layout) { // do that } return false;
}
View 4 Replies
View Related
May 23, 2010
I'm embarking on a GUI Activity composed of a viewflipper, which I would like to contain 10 linearlayout layouts. Is it advisable to put all of my layouts into the same XML resource/layout file? If not, is there a more organized approach to coding a viewflipper with many layouts? Will having everything in the same file come at a significant performance cost?
View 2 Replies
View Related
Jul 2, 2010
I have a problem with a tab view on android. I am using 4 xml layout files (each a RelativeLayout) as the content for tabs in a tab view. The main.xml contains: TabHost (@android:id/tabhost) containing a linearLayout which contains a TabWidget (@android:id/tabs) and a FrameLayout (@android:id/tabcontent). If I embeded the multiple one after another in the in the main.xml everything works fine (except my main.xml is unmaintainable which is the problem I want to solve by splitting the files into a simple main.xml which defines the tab and the content frame and then push the views onto this). The code I have to inflate and insert the 4 RelativeLayout xml files into the tab content is as follows:
mTabHost = getTabHost(); View wv = null;
wv = LayoutInflater.from(this).inflate(R.layout.user_tab, mTabHost.getTabContentView(), true);
mTabHost.addTab(mTabHost.newTabSpec("User").setIndicator("User").setContent(wv.getId()));
wv = LayoutInflater.from(this).inflate(R.layout.track_tab, mTabHost.getTabContentView(), true);
mTabHost.addTab(mTabHost.newTabSpec("Track").setIndicator("Track").setContent(wv.getId()));
wv = LayoutInflater.from(this).inflate(R.layout.chart_tab, mTabHost.getTabContentView(), true);
mTabHost.addTab(mTabHost.newTabSpec("Chart").setIndicator("Chart").setContent(wv.getId()));
// And so on for the multiple tabs.
When I run this the first tab (User) is empty and the remaining tabs have all the content from all the views. So tab2 has the content from tab1-4, tab3 has the content from tab1-4 and tab4 has the content from tab1-4. Returning to tab1 it then has all the content from tab1-4 now. The code works just fine, the events on the various objects in the views etc all are good. It is just that they are all muddled together in the view. What is causing this and how to correct it?
View 2 Replies
View Related
Jan 23, 2010
I've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. How do I specify for each activity which xml file is it's portrait layout and which is the Landscape layout? Is it also possible to specify different layouts for different screen sizes? If so, how is this done?
View 2 Replies
View Related
May 12, 2009
I want to be able to make an imageview move from point a to b while going through several different views. For example, say I have a table layout, is there any way an imageview can move from the topleft cell to the bottomright cell? Everything I tried seems to indicate that an imageview will only be shown in it's own container - none of it's parents, siblings or children will show it. Is that correct? is there any way around it? like creating an overlay or a transparent canvas on top of the entire thing so I can do it?
View 3 Replies
View Related
Apr 24, 2009
Having read http://android-developers.blogspot.com/2009/04/future-proofing-your-a... l I noted this little section;
"Due to changes in the View rendering infrastructure, unreasonably deep (more than 10 or so) or broad (more than 30 total) View hierarchies in layouts are now likely to cause crashes. This was always a risk for excessively complex layouts, but you can think of Android 1.5 as being better than 1.1 at exposing this problem..."
Will the SDK warn us when we're reaching the limit for crashes?
And more to the point why does it crash and not return some form of meaningful error to the app? With an error code or thrown exception developers could create various levels of layout complexity and step down the layout complexity level until they find one the device will support.
No matter what the post says I see this as a regression in functionality and I definitely do not see it as "Android 1.5 as being better than 1.1" in any way.
Written an Android App? - List it at[url]
Funky Android Limited is registered in England & Wales with the company number 6741909. The registered head office is Kemp House, 152-160 City Road, London, EC1V 2NX, UK.
The views expressed in this email are those of the author and not necessarily those of Funky Android Limited, it's associates, or it's subsidiaries.
View 20 Replies
View Related
Apr 2, 2009
I have an activity which extends TabActivity and implements TabContentFactory. For simplicity's sake I'll limit the problem to 1 tab.
In onCreate() I do this:
CODE:..........
In createTabContent:
CODE:...........
So far, so great. I get the tab, the layout is displayed.
I also have a button in the layout, so I do:
CODE:.............
And then I subscribe to it's click event:
CODE:..........
Now, here's the problem. I click the button and nothing happens. I can for example execute the following code from elsewhere:
CODE:.............
And the button will get disabled, but when I tap it (in its *enabled* state) - nothing happens.
If I'm not, could it be that I have another tab, where the another inflated copy of the same layout is displayed? However, in this layout's button's OnClickListener nothing happens as well.
View 3 Replies
View Related
Oct 27, 2010
I have set my layout thru TabLayout within LinearLayout but still my button in the end couldn't be set properly as TabLayout divides all the fields in number of columns so can anyone help how to set 2 Layouts in one XML file
means all the fields in TabLayout and remaining both Login and Register buttons in Linear Layout ore some other so that they can set properly. code...
View 2 Replies
View Related
Oct 29, 2009
Could you recommend a tutorial for custom Layouts / ViewGroups? I couldn't find one.
My first project is to move the functionality of a GridView + Adapter to a ViewGroup, to put the enclosed Views in a grid.
View 2 Replies
View Related