Android :: Change Orientation Just By Sensing Layout Position , Port / Land?
Apr 15, 2009I am wondering if we can change orientation just by sensing the layout position, port or land;without flip like iphone does.
View 4 RepliesI am wondering if we can change orientation just by sensing the layout position, port or land;without flip like iphone does.
View 4 RepliesWhile developing for Android, I am unable to open more than one main.xml file in an Eclipse editor at a time.Each time I open one, it simply replaces the editor (tab) of the first main.xml with the new one, instead of opening a new tab - even if the contents of the existing tab were unsaved.Even stranger, I can open multiple main.xml files from different projects with no problems.This only happens when they're within the same project.
View 2 Replies View RelatedI have a layout which contains a TextView.
The content of the TextView might change on runtime. (discussed on a different issue here: http://stackoverflow.com/questions/3683727/layout-with-dynamic-position )
I can position the layout by drag&drop. If the size of the layout doesn't change, the position stays, but as soon as the size of the layout changes (because more text inside the TextView) the position is reseted.
I use the layout(left, top, right, bottom) to position the layout.
Now I don't know where I should add my layout() call to make sure it stays at the right position...
Here is my class
CODE:............
I want to know how to change the orientation of my layout inside of eclipse but when I click the "layout" button it still shows it as a vertical layout.
View 4 Replies View RelatedI want to know how to change the orientation of my layout inside of eclipse.
View 1 Replies View RelatedThe xml files that contains the Activity layouts can be rendered by Eclipse.
How do I get that Eclipse screen area to have vertical orientation, not horizontal (inside Eclipse - it correctly shows as vertical in the emulator)?
is there a way to have a view use a different layout when an orientation change occurs. suppose i want the view to look one way in portrait and another way in landscape. all the same data, but arranged differently.I'm thinking one way to do this would be to have two different linear layouts with android:visibility="gone" and simply display the appropriate one (set android:visibility="visible") based on orientation -- i.e. do this from code.is there a way to do this in xml? or something like this (i.e. in landscape, put the textview here, in portrait, put it here instead)?
View 2 Replies View RelatedI have 5 layout folders. layout, layout-small, layout-normal, layout-medium and layout-large.
My app is heavily image based. As a result I have created the proper images. mdpi, hdpi and xhdpi. I don't think I need to worry about ldpi since screens are only getting bigger.
With this in mind and the need for me to now create a good landscape layout for all my pages, how do I go about this? Is it simple layout-land? No need for large/small/normal again right?
Considering that I've got all my hdpi and xdpi images do I even need layout-medium, layout-large and layout-normal? Because the images will be adjusting themselves based on screensize surely I can use one layout and have that work for all screens..?
It's all getting very confusing now that I'm trying to add a landscape view to my app. It doesn't do it very well at the moment so I will probably have to design a landscape friendly layout so I can understand that I would need to rebuild all my layouts for this particular use (We're talking about 100 layous here but oh well, I can manage it. )
I just want to group 4 buttons like this...
Portrait mode:
[1][2]
[3][4]
Landscape mode:
[1][2][3][4]
I dont want to hardcopy my Portrait mode xml-File and put it into the "layout-land" folder for this minor difference. Then, I have to modify two file when implementing new stuff.
Isnt that achievable through wraping it up intelligently in some LinearLayouts? Something like this? ({} represent LinearLayouts)
{{[1][2]}{[3][4]}}
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 RelatedI 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?
How do i find the current orientation of the phone (portrait or landscape) How do i find the slider position?
View 2 Replies View RelatedHas anyone figured out how to change the location from Sugar Land TX?, or
how to change some of the other settings on the screen also. I'm also trying
to find a users manual for e-mobile.
i am trying to display a linear layout , say at setpadding (10,10,0,0); now i need to put some buttons at particular xy position in layout.button position doesn't seem to work in that way. can anybody suggest how can i set button position in layout?
View 3 Replies View RelatedI have a layout which might be a bit unusual.
The structure is the following:
CODE:..............
My customRelativeLayout at the bottom of the XML has a XML layout too:
CODE:.............
My CustomRelativeLayout:
CODE:.....................
What I want to do: I want to be able to change the position of my CustomRelativeLayout. It should be follow my touch. Its smaller than the SurfaceView and should "slide" above following my touch...
There are two problems:
The onTouchListener bind to mLinearLayout (in CustomRelativeLayout) is only triggered once and only for ACTION_DOWN. I see the log output only once The note never changes the position, it is never redrawn with the changed matrix... I see the output stated in onDraw never after the touch happened.
First might be because the SurfaceView also handles touch events. But I thought if the CustomRelativeLayout handles it first, it should work.
Thanks to Xil3 I was able to remove the wall I was run into...
Here is my solution:
My note xml:
CODE:.................
And here is my constructor:
CODE:..................
I also found a bug/feature/issue, which is absolutely new for me: When I remove the background in my note root element (which is currently transparent) the note is only visible within the 200dp width/height I have set in the inner LinearLayout. So its not fill_parent, its wrap_content even as I set it to fill_parent. So layout_width and layout_height only use the given fill_parent when a background is set...
Can one of the few of you who has a Droid X let me know the orientation of the Micro USB port? I'm thinking of getting a right angle (or left angle) micro usb cable and I want to make sure I get one where the cable runs down towards the bottom of the device. I'm pretty sure that the Moto Droid and the HTC Incredible are oriented differently.
View 10 Replies View RelatedRelativeLayout is more flexible, and can do what AbsoluteLayout can do and more.
http://developer.android.com/reference/android/widget/RelativeLayout....
To place views on top of one another you can also use FrameLayout, positioning these frame layouts in their parent layout:
http://developer.android.com/reference/android/widget/FrameLayout.html
18.08.2010 19:11, ericmahlon пишет:
> I have an image that will have 5 different areas that will be "clickable." Each clickable area will be invisible and play a different sound. I was told not to use an absolute layout, and use a linear layout instead. However, I am now having an issue with placing the buttons over the picture. The linear layout does not allow me to position them correctly where they need to go. How do I properly position a button so that it is over a certain part of the image?
I have an image setup inside an absolute panel.I am trying to set it's position via code.But I do not see any applicable method/property to set its position.
Here is my layout.
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/marker" android:src="@drawable/marker" android:layout_y="106dp" android:layout_x="290dp"></ImageView>
</AbsoluteLayout>
Here is my code to set its position...
I figured that I can have custom layout for each orientation just by making two folders layout-port and layout-land. So I put different views in these folders. Worked well.
Now, I have a webview in my activity and it reloads whenever there is any change in orientation. So to prevent that I put android:configChanges="orientation" in my manifest file.
After putting this the reloading stopped but the contents in the layout-port started getting selected for landscape mode as well.
I have a notification that starts my activity and passes a messages using the intent's putExtra() function. The message is then displayed to the user in the activity's onCreate function. When the application is restarted due to a orientation change, the message is shown again as it is still in the intent's bundled data.
How can I remove the extra data?
I tried the following:
Bundle bundle = getIntent().getExtras();
if (bundle.getBoolean("showMessage")) {
// ... show message that is in bundle.getString("message")
// remove message
bundle.remove("showMessage");
}
But the message will still be shown after the orientation changed, seems like the intent used is not the one I changed, but the original one. The only workaround I found is to save the showMessage additionally in onSaveInstanceState(). Is there another way? Or is this the way to go?
Context Menu seems quite handy as long as we are using an AdapterView as we can easily get selected item position in onContextItemSelected from AdapterContextMenuInfo.position Any idea how we can achieve something similar in a TableLayout? In my TableLayout, i have some TableRow and i would like to get the row index in the onContextItemSelected callback like i would do with a simple ListView. I guess i will have to register the contextmenu for each row? but how can tie the row index with the menu? i see no way to do it with registerForContextMenu.
View 2 Replies View RelatedI have a program with two layouts: - layout/main.xml - layout-land/main.xml
Also, i have some images en drawable and drawable-land...
My problem is: When i change the orientation of the emulator (for examplo: portrait to landscape) i don't know how reload the main.xml layout to update the screen with the new positions....
If I launch the emulator in portrait the application load the portrait layout, and if I launch the emulator in landscape mode the application load the landscape layout, but if I change the orientation in execution mode the application don't load the new layout...
How can I reload the layout?
My activity use the same RelativeLayout as it's content view whatever the orientation is. In this RelativeLayout, there is a FrameLayout align to it's bottom, and a TextView above this FrameLayout, just like :
CODE:...........
on android 1.5 device when orientation changed, the TextView lies in the wrong place, middle when portrait, bottom when landscape. on android 1.6 device It is ok.
How could I make it lies in the place where it should be on 1.5 device?
I've been trying to solve this for awhile now, and still couldn't find a solution to it. To properly display my SirfaceView consumed by the camera, I have forced my activity's layout in landscape mode. However, in my app the camera functionaluty will be mostly used in portait mode, and therefore all other views in the same activty have to be in portrait mode. Needless to say if I don't force the activity in landscape, the SurfaceView is 90 degrees rotated.
View 9 Replies View RelatedI have a widget which has say, a dimension of 294*72(portrait). But when the orientation is changed, I need to change this dimension of the widget to another dimension which would look good on the landscape orientation.
View 4 Replies View RelatedWe have just published our smart camera application. Ever wished your pictures taken at night can be better? SmartCam helps you to take clear (non-blurry) pictures especially at night. It monitors your hand stability using the accelerometer and automatically clicks when the camera is steady. So, forget about touching that small button while trying hard to keep your hand steady. Just buy this app and let it do the clicking job for
View 1 Replies View RelatedI have a custom view that I had to write for a large scrollable image, as the images are larger than the size of the screen. Before, I had tried to do it by putting the image into a ScrollView but that of course didn't work. The view itself is within a RelativeLayout within the activity and at the bottom of the screen I have two buttons that are used for navigation and at the top a TextView with a caption for the activity (the main header is already being used here for instruction). In my below code, I've checked the Hierachy Viewer to confirm all the elements are loaded and in the Activity I can see the TextView, however it overlays the ZN5ScrollView area and below the image I just have a blank area of the size defined rather than my buttons. For the bottom navigation, the Hierachy Viewer is saying the absolute_y of the bottom navigation is 480. I'm wondering if anyone can help with my layout code here to get this working correctly? Bottom navigation is 50px high, ZN5ScrollView is 365px above the navigation, and the TextView takes up the rest of the area at the top
View 4 Replies View RelatedI have played around a bit with the xml files for creating layouts and can't explain the behaviour of layout_weight when using it in a LinearLayout that has orientation="vertical"
When creating a layout that is horizontal everything follows the documentation, that a child would get more space if it's has the highest value.
But the following code for vertical orientation, give more space to the item with lowest weight.
CODE:..........
And the question is: Is this a bug or just a feature that maybe need more documentation?
I have an image set as my background and when it is vertical, the image looks fine. However, when the orentation is changed, the image get streched out. If there a way that I can change the image based on the orentation of the device?
View 4 Replies View RelatedIs it possible for my android application to dynamically adjust the no of column and no of row of my TableLayout based on orientation?
For example, when in landscape mode, the TableLayout is 3x2 and when
in portrait mode, the TableLayout is 2x3?