How to get rid of platform dependency for my RelativeLayout? - android

I have the following RelativeLayout (landscape mode) in my application:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ivLeft" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ivRight"
android:layout_toRightOf="#id/ivLeft"/>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ivClose"
android:onClick="onClose" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="65dp"
android:id="#+id/ivSwitch"
android:onClick="onSwitch" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="130dp"
android:id="#+id/ivAnaglyph"
android:onClick="onAnaglyph" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="195dp"
android:id="#+id/ivWiggle"
android:onClick="onWiggle" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="260dp"
android:id="#+id/ivSave"
android:onClick="onSave" />
</RelativeLayout>
It renders correctly (at least it renders the same) on different mobile platforms like modern HTC, LG, One Plus etc. The result should be that the two images (of the same size) split the landscape screen into two equal halves. The smaller symbols are on the left hand side below each other (covering the left image).
But the latest Sony XPeria (Z3 and M4 Aqua) beg to differ. The small symbols are positioned correctly, but the first big image takes more than half of the screen (it moves significantly to the right) so the second image has not enough space left to maintain its full size. I already tried to temporarily remove the small symbols, with no difference at all!
Maybe I need a new approach: How can I split the landscape layout into two equal halves, independent of the resulting platform? I'm not forced to use RelativeLayout ... what would help me here?

Thanks to #Frank N. Stein I was able to solve the issue with two RelativeLayouts nested inside a LinearLayout using weights like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ImageView
android:layout_height="wrap_content"
android:id="#+id/ivLeft"
android:layout_width="wrap_content" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="#+id/ivClose"
android:onClick="onClose" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="65dp"
android:id="#+id/ivSwitch"
android:onClick="onSwitch" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="130dp"
android:id="#+id/ivAnaglyph"
android:onClick="onAnaglyph" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="195dp"
android:id="#+id/ivWiggle"
android:onClick="onWiggle" />
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="260dp"
android:id="#+id/ivSave"
android:onClick="onSave" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ImageView
android:layout_height="wrap_content"
android:id="#+id/ivRight"
android:layout_width="wrap_content" />
</RelativeLayout>
</LinearLayout>

Related

Design layout display is not the same

How to edit xml file layout. All display screen is the same.
screen size 4.7", 5.0" display accuracy. But screen other than this. Display Distortion. Except screen tablet.
Help me fix it.
screen_main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="jp.vertice.test.MainScreenFragment">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#51c8fc">
<ImageView
android:layout_width="200dp"
android:layout_height="195dp"
android:id="#+id/imageView2"
android:src="#mipmap/ic_launcher"
android:background="#fc0c0c"
android:layout_marginLeft="18dp"
android:layout_marginStart="18dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/btn1"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/btn3"
android:layout_alignStart="#+id/btn3" />
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/btn2"
android:layout_below="#+id/btn1"
android:layout_alignLeft="#+id/btn1"
android:layout_alignStart="#+id/btn1" />
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/btn5"
android:layout_below="#+id/btn2"
android:layout_alignLeft="#+id/imageView2"
android:layout_alignStart="#+id/imageView2"
android:layout_marginTop="5dp" />
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/btn4"
android:layout_alignTop="#+id/btn5"
android:layout_toRightOf="#+id/btn5"
android:layout_toEndOf="#+id/btn5"
android:layout_marginLeft="9dp"
android:layout_marginStart="9dp" />
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/btn3"
android:layout_alignTop="#+id/btn4"
android:layout_toRightOf="#+id/btn4"
android:layout_toEndOf="#+id/btn4"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="205dp"
android:background="#F4F4F4"
android:layout_gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="YYYY.MM.DD"
android:id="#+id/txt1"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="22dp"
android:layout_marginStart="22dp"
android:layout_marginBottom="173dp" />
<TextView
android:layout_width="230dp"
android:layout_height="50dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
android:id="#+id/text2"
android:layout_alignTop="#+id/txt1"
android:layout_alignLeft="#+id/txt1"
android:layout_alignStart="#+id/txt1"
android:layout_marginTop="25dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON"
android:id="#+id/btn6"
android:layout_marginLeft="11dp"
android:layout_marginStart="11dp"
android:layout_alignTop="#+id/text2"
android:layout_toRightOf="#+id/text2"
android:layout_toEndOf="#+id/text2" />
<TextView
android:layout_width="fill_parent"
android:layout_height="20dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="FOOTER"
android:id="#+id/textView2"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="10sp"
android:textStyle="bold"
android:textAlignment="center"
android:gravity="center_vertical"
android:background="#FFFFFF" />
</RelativeLayout>
</FrameLayout>
Don't use Frame Layout here because Frame Layout used to show single view.
I see you are using fixed dp values for layout_width and layout_height.
dp means density independent pixel. It is not a size independent pixel.
The dp makes sure your layout looks the same on devices with the same size, but different pixel density. It will not look the same on bigger devices.
If you want it to scale to larger devices you will have to use match_parent and wrap_content.
Use the power of the relative layout to place items on the right side of the screen also.
You can also make separate layout files for differently sized devices. So you can customise it depending on the size.
You do this by making a new layout folder named for example layout-sw600dp/ (or any number you want) which will only be used on devices that have at least the width you specified (so 600dp in this example).
Make sure your layout file has the same name in this folder as in the normal folder.
You can find very useful information about this in the documentation:
here and here.
You can try using a GridLayout. This way, the image columns will fill the whole screen.
you can't work with dp and expect the same result on different
if you want same display for all the devices you can work with weightSum and weight here is a little example
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2">
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:id="#+id/layout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

Why does using layout_below mess up the size of the start button?

I have the following xml layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/light_blue"
tools:context=".StoppedActivity">
<TextView
android:id="#+id/totalTimeView"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_marginBottom="90dp"
android:layout_alignParentTop="true"
android:background="#android:color/white"
android:textColor="#color/started_black"
/>
<TextView
android:id="#+id/countDownView"
android:layout_below="#+id/totalTimeView"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/white_circle"
android:textColor="#color/started_black"
android:gravity="center"
android:textSize="65sp" />
<ImageButton
android:id="#+id/settings"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:src="#drawable/ic_settings_black_24dp"
android:scaleType="fitXY"
/>
<ImageButton
android:id="#+id/startButton"
android:background="#drawable/button_selector"
android:layout_width="360dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="60dp" />
<ToggleButton
android:id="#+id/toggleSwitch"
android:background="#drawable/toggle_selector"
android:layout_centerInParent="true"
android:layout_below="#+id/countDownView"
android:layout_marginTop="40dp"
android:layout_width="300dp"
android:layout_height="50dp" />
</RelativeLayout>
Currently it displays everything correctly on Nexus 5X, but the layout gets messed up when used in a device with a different screen size. To ensure that doesn't happen, I added the line
android:layout_below="#id/toggleSwitch"
to
<ImageButton
android:id="#+id/startButton"
android:background="#drawable/button_selector"
android:layout_width="360dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_below="#id/toggleSwitch"
android:layout_centerInParent="true"
android:layout_marginBottom="60dp" />
However, this messes up the sizing of the start button, why is this happening? How do I fix this? Thank you in advance.
It's because you tell your layout that the button is going to fill the space available in between the bottom of"#id/toggleSwitch (that's what below does) and the bottom of your parent layout (because you specified android:layout_alignParentBottom="true")
Instead, you can define a blank view filling the space between your toggle switch and your button, so it won't mess up you button height:
<ToggleButton
android:id="#+id/toggleSwitch"
android:background="#drawable/toggle_selector"
android:layout_centerInParent="true"
android:layout_below="#+id/countDownView"
android:layout_marginTop="40dp"
android:layout_width="300dp"
android:layout_height="50dp" />
<View
android:layout_width="1dp"
android:layout_height="1dp"
android:background="#android:color/transparent"
android:layout_below="#id/toggleSwitch"
android:layout_above="#+id/startButton"/>
<ImageButton
android:id="#id/startButton"
android:background="#drawable/button_selector"
android:layout_width="360dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="60dp" />
Depending on what you are trying to achieve, you may have to adjust the code. But if you want to fill a vertical blank space with the available vertical space (Which I understand you're trying to do to adapt you layout for different phones), that's one way to do it. Alternatively, you could use a LinearLayout for the bottom of your screen and use the layout_weight attribute, but the above solution is probably cleaner if you want to keep your current layout implementation.

How to resize images according to screen size?

I have made an app that shows 6 images, 3 per row. It looks perfect in the layout designer of android studio but not on physical device that has an other screen resolution. I wasn't surprised about that but I don't know how to make the app compatible to all screen sizes.
Layout designer Android Studio:(1:4)
Physical Device:(1:2)
Source code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="com.test.testing.app.MainActivity">
<ImageView
android:id="#+id/Image1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:contentDescription="Image1"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image3"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/Image2"
android:layout_marginRight="5dp"
android:contentDescription="Image3"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignTop="#+id/Image1"
android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#id/Image3"
android:layout_toRightOf="#id/Image1"
android:contentDescription="Image2"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image4"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Image1"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:contentDescription="Image4"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image5"
android:layout_width="100dp"
android:layout_height="100dp"
android:contentDescription="Image5"
android:src="#drawable/_5221802"
android:layout_alignTop="#+id/Image6"
android:layout_alignRight="#+id/Image2"
android:layout_alignEnd="#+id/Image2"
android:layout_alignLeft="#+id/Image2"
android:layout_alignStart="#+id/Image2" />
<ImageView
android:id="#+id/Image6"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_below="#id/Image3"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:contentDescription="Image6"
android:src="#drawable/_5221802" />
Why not use Linear Layout and set equal weights for all three images in a row.
Look at this code, I have trimmed it a bit, but the main parts are:
Changed RelativeLayout to LinearLayout (with 'horizontal' orientation), then changed the width of all three images to 0dp - android:layout:width="0dp", and added equal weight layout_weight = "1" for all three of them'
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/Image1"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:contentDescription="Image1"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image3"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:contentDescription="Image3"
android:src="#drawable/_5221802" />
<ImageView
android:id="#+id/Image2"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:contentDescription="Image2"
android:src="#drawable/_5221802" />
</LinearLayout>
This would work on any device of any screen size.
Actually, you need not have to run the app to see how your app's layout will look on particular device, you can check that in Eclipse - layout editor. There are many dropdowns at the top bar for you to select the type of device where you want your app to run and find out, how it will look there.
To answer your question, ideally, you should define Gridview and add your images there.

How to make my layout fit in all screens

I have gone through many relative answers on stockoverflow and link's such as Supporting Different Screens or Screen Compatibility Mode
I have created the following relative layout and I am trying to make it look alike in all android screens.
My images fit perfect for 4.8 inch phones but when I try to use a 2.8 inch display or something like like that, some buttons go on top of others, and they do not shrink.
Does anyone have any suggestion how to improve that?
And preferably without increasing the size of my app.
Thanks in advance!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:mm="http://millennialmedia.com/android/schema"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background"
tools:context=".MainActivity" >
<ImageButton
android:id="#+id/Switch_off"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="someMethod"
android:background="#drawable/switch_off"/>
<ImageView
android:id="#+id/warning_shot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#drawable/more"
android:onClick="someMethod" />
<ImageView
android:id="#+id/imageViewBatteryState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/Switch_off"
/>
<ImageView
android:id="#+id/sh"
android:layout_width="147dp"
android:layout_height="54dp"
android:layout_below="#+id/Switch_off"
android:layout_centerHorizontal="true"
android:background="#drawable/me"/>
<ImageView
android:id="#+id/sit"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_below="#+id/Switch_off"
android:layout_centerHorizontal="true"
/>
<TextView
android:id="#+id/textViewBatteryInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="12sp"
android:textStyle="bold"
android:typeface="monospace"
android:layout_alignBottom="#+id/sit"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
I will suggest you to use LinearLayout instead of Relativelayout specially for the issue :
My images fit perfect for 4.8 inch phones but when I try to use a 2.8
inch display or something like like that, some buttons go on top of
others, and they do not shrink.
Because When you give orientation to Linearlayout then Its child will never get on top of each other for any resolution or screen size.
And If you give them Weight then Views will be in fix position for Each and Every device.
For example Put below Xml in your project and Check this out in Any resolution, It will give the same Result.
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:mm="http://millennialmedia.com/android/schema"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button 1" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button 2" />
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button 3" />
</LinearLayout>
</LinearLayout>

How to define two different layouts for the layouts in the same category but slightly different inches?

I am testing my layout in eclipse's graphical layout. There are 5.4in FWVGA(480x854,mdpi) and 5.1in WVGA(480x800,mdpi) screens available to view in the graphical layout. If I am correct they both fall into large screen category, therefore I've put the layout xml into layout-large folder. And I've put my images into drawable-large-mdpi folder. But the image buttons are slightly off in 5.1in WVGA as you can see in the screenshots below. First is 5.1in, the second screenshot is 5.4'' and the correct one.
My second question which is similar to the above goes like this. I've done new layout for the Nexus 7 and put it into layout-sw600dp folder, and images to the drawable-tvdpi. Then I viewed this layout in the 7in tablet (1024x600,mdpi). And the image buttons are slightly off than it should look. The same way as in the first question.
I understand that the reason is probably because 5.1in and 5.4in isn't exactly the same even though they fall into the same category and I should have 2 different layouts for them. So how I should go about it? How can I have two different layouts? Or is there better solution, as I don't want to create a layout for each screen size that exist on the market.
Here is xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="#drawable/wall4_cabinetclosed" android:orientation="vertical">
<RelativeLayout android:id="#+id/frames_layout"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="73dp" android:layout_marginTop="57dp">
<ImageView android:id="#+id/fire_frame"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
android:background="#drawable/small_fire_icon" />
<ImageView android:id="#+id/water_frame"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="#+id/fire_frame" android:layout_marginLeft="75dp"
android:layout_toRightOf="#+id/fire_frame" android:background="#drawable/small_water_icon" />
<ImageView android:id="#+id/earth_frame"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="#+id/fire_frame" android:layout_marginTop="71dp"
android:layout_toLeftOf="#+id/water_frame" android:background="#drawable/small_earth_icon" />
<ImageView android:id="#+id/wind_frame"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="#+id/water_frame" android:layout_alignTop="#+id/earth_frame"
android:background ="#drawable/small_wind_icon" />
</RelativeLayout>
<ImageView android:id="#+id/zoomed_image"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button android:id="#+id/frames" android:layout_width="210dp"
android:layout_height="220dp" android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:layout_marginLeft="55dp"
android:layout_marginTop="30dp" android:onClick="zoomFrames"
android:background="#android:color/transparent"/>
<Button android:id="#+id/blue" android:layout_width="115dp"
android:layout_height="70dp" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_marginLeft="220dp"
android:onClick="zoomImage"
android:background="#android:color/transparent"/>
<Button android:id="#+id/white" android:layout_width="85dp"
android:layout_height="50dp" android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:layout_marginRight="420dp"
android:layout_marginTop="420dp" android:onClick="zoomImage"
android:visibility="invisible"
android:background="#android:color/transparent"/>
<ImageView
android:id="#+id/fireplace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="311dp"
android:layout_marginLeft="67dp"
android:background="#drawable/fire"
/>
<ImageButton
android:id="#+id/water_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="310dp"
android:layout_marginLeft="90dp"
android:background="#drawable/view_water_room"
android:onClick="finishFireRoom"
android:visibility="gone"
/>
<ImageView android:id="#+id/frames_zoomed_image"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#drawable/frames_zoomed" android:onClick="hideZoomedFrames"
android:visibility="gone"/>
<RelativeLayout android:id="#+id/frameZoomedLayout"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="113dp" android:layout_marginLeft="145dp"
android:visibility="gone"
>
<ImageButton android:id="#+id/fire_icon"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="#drawable/fire_icon" android:onClick="changeIcon" />
<ImageButton android:id="#+id/water_icon"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="#+id/fire_icon" android:layout_toRightOf="#+id/fire_icon"
android:background="#drawable/water_icon" android:layout_marginLeft="147dp" android:onClick="changeIcon"/>
<ImageButton android:id="#+id/earth_icon"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="#+id/fire_icon" android:layout_marginTop="140dp"
android:layout_toLeftOf="#+id/water_icon" android:background="#drawable/earth_icon" android:onClick="changeIcon"/>
<ImageButton android:id="#+id/wind_icon"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="#+id/water_icon" android:layout_alignTop="#+id/earth_icon"
android:background="#drawable/wind_icon" android:onClick="changeIcon"/>
</RelativeLayout>
</RelativeLayout>
in 3rd step set all ur device specific like screen, language etc all. and ur done

Categories

Resources