If i have created the application in 2.2 android plaform and a user who decides to download the application and has a phone which is on 4.0.3 platform the layout of the application on the 4.0.3 phone tends to mess up. how do i go about correcting this?
Android Layout Issue
Page 1 of 18 Replies - 835 Views - Last Post: 06 May 2012 - 01:21 PM
Replies To: Android Layout Issue
#2
Re: Android Layout Issue
Posted 03 May 2012 - 12:09 PM
I don't really understand.
Dose the device with Android 4.0.3 have a different screen resolution?
Dose the device with Android 4.0.3 have a different screen resolution?
#4
Re: Android Layout Issue
Posted 03 May 2012 - 05:41 PM
you can always make separate layouts for each api version.
For example, you can create a layout.xml specifically for devices running version 4.0.3. Just make a folder in /res named like this: layout-v15. Anything not included in the version specific folder defaults to the regular layout folder, so you don't need to recreate every xml file.
This can also be done with your drawable or values folder
For example, you can create a layout.xml specifically for devices running version 4.0.3. Just make a folder in /res named like this: layout-v15. Anything not included in the version specific folder defaults to the regular layout folder, so you don't need to recreate every xml file.
This can also be done with your drawable or values folder
#5
Re: Android Layout Issue
Posted 04 May 2012 - 11:39 PM
What i mean is that when i download the application onto my HTC Phone (2.3.3) the buttons are correctly positioned in the middle however when the application is downloaded onto another device (4.0.3) the buttons tend to be out of place. for example one button will be at the bottom and the other will be at the top of the page. How do i go about correcting this issue?
#6
Re: Android Layout Issue
Posted 05 May 2012 - 09:07 AM
Please post your xml-layout code
#7
Re: Android Layout Issue
Posted 05 May 2012 - 12:41 PM
The layout code is as below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout style="@style/TitleBar">
<ImageButton style="@style/TitleBarOperation"
android:src="@drawable/home_def"
android:onclick="onHome"
android:layout_marginTop = "5dip"
android:layout_marginRight="5dip"
android:layout_marginLeft="5dip"
android:layout_marginBottom = "5dip"
android:paddingBottom = "5dip"
android:background="@drawable/bg_state"
android:layout_gravity="center"
android:paddingLeft="5dip"
android:paddingRight="7dip"/>
<ImageView android:layout_width="1px"
android:layout_height="fill_parent"
android:background="@drawable/separator"
android:layout_marginRight="7dip"
/>
<TextView style="@style/TitleBarText"
android:paddingLeft="8dip"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@+id/list_view_id"
android:persistentDrawingCache="animation|scrolling"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layoutAnimation="@anim/list_layout_controller" android:background="@drawable/imagess"/>
</LinearLayout>
</LinearLayout>
#8
Re: Android Layout Issue
Posted 05 May 2012 - 01:33 PM
LinearLayouts are not the best for positioning. I personally prefer RelativeLayouts. You can align components better.
If you don't want to switch, there are better ways to center an item than positioning with padding and margins:
android:layout_centerVertical="true"
or
android:layout_centerHorizontal="true
dp units are not the same with every device resolution
If you don't want to switch, there are better ways to center an item than positioning with padding and margins:
android:layout_centerVertical="true"
or
android:layout_centerHorizontal="true
dp units are not the same with every device resolution
This post has been edited by htc(hot-taco-cheese): 05 May 2012 - 01:35 PM
#9
Re: Android Layout Issue
Posted 06 May 2012 - 01:21 PM
Thank you for helping me out ive solved it now. Thnx
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote






|