Quantcast

Screen sizes and layouts

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Screen sizes and layouts

ledz
Hi there,

The application I'm developing needs to support several different sizes, from Normal to Extra Large. I'm using sp for text size and dp for everything else, as recommended in android's best practices. The thing is... In many places the only thing that changes is the text size, and I really need to set a different size for each screen layout - unless I'm mistaken. This is kind of awful as I'll have to have layouts for every screen size, in some cases multiplied by orientation. So my question here is... isn't there some other way (easier one) for doing this?

I've looked at the text appearance flags, like ?android:attr/textAppearanceMedium but they look completely different across sizes, so that isn't good enough either.
I know this is not exactly Xamarin related, but Android, though... I'd appreciate some hints on "the best way" of doing this.

Cheers

--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Screen sizes and layouts

mattleibow
Using the Xamarin designer really helps. All you have to do is open the base layout and then switch to the other sizes from the drop down.
If you have the various locks on, it keeps track of which settings are changed on which screen size. It even asks you if you want to apply those changes to the other screen sizes.

On Thu, Aug 16, 2012 at 7:09 PM, Goncalo Oliveira <[hidden email]> wrote:
Hi there,

The application I'm developing needs to support several different sizes, from Normal to Extra Large. I'm using sp for text size and dp for everything else, as recommended in android's best practices. The thing is... In many places the only thing that changes is the text size, and I really need to set a different size for each screen layout - unless I'm mistaken. This is kind of awful as I'll have to have layouts for every screen size, in some cases multiplied by orientation. So my question here is... isn't there some other way (easier one) for doing this?

I've looked at the text appearance flags, like ?android:attr/textAppearanceMedium but they look completely different across sizes, so that isn't good enough either.
I know this is not exactly Xamarin related, but Android, though... I'd appreciate some hints on "the best way" of doing this.

Cheers

--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid



_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Screen sizes and layouts

ssharrock
In reply to this post by ledz
I'm a C# programmer, not Android, so this may be idiotic to a real Android programmer; but...
 
I have projects which all have 4 folders for Values that each contain a different Styles.xml file.
 
Resources/Values-xlarge
Resources/Values-large
Resources/Values-normal
Resources/Values-small
 
Each Styles.xml has entries like...
 

<style name="NormText">

<item name="android:textSize">16sp</item>

</style>

<style name="NormBtn">

<item name="android:textSize">18sp</item>

<item name="android:layout_height">wrap_content</item>

</style>

This way I only need one Layout that references the style from the appropriate folder based on size.
 

<Button

android:id="@+id/startBtn"

style="@style/NormBtn"

android:layout_width="fill_parent"

android:text="Start Location Service"

/>

 
Steve Sharrock
Architecture/Design/Programming
<A href="blocked::http://www.sharkcode.com/">www.sharkcode.com
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Goncalo Oliveira
Sent: Thursday, August 16, 2012 10:09 AM
To: Discussions related to Mono for Android
Subject: [mono-android] Screen sizes and layouts

Hi there,

The application I'm developing needs to support several different sizes, from Normal to Extra Large. I'm using sp for text size and dp for everything else, as recommended in android's best practices. The thing is... In many places the only thing that changes is the text size, and I really need to set a different size for each screen layout - unless I'm mistaken. This is kind of awful as I'll have to have layouts for every screen size, in some cases multiplied by orientation. So my question here is... isn't there some other way (easier one) for doing this?

I've looked at the text appearance flags, like ?android:attr/textAppearanceMedium but they look completely different across sizes, so that isn't good enough either.
I know this is not exactly Xamarin related, but Android, though... I'd appreciate some hints on "the best way" of doing this.

Cheers

--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Screen sizes and layouts

ledz
Thanks Steve, that might help. Need to explore styles a little better.

Cheers

On 16 August 2012 20:09, Steve Sharrock <[hidden email]> wrote:
I'm a C# programmer, not Android, so this may be idiotic to a real Android programmer; but...
 
I have projects which all have 4 folders for Values that each contain a different Styles.xml file.
 
Resources/Values-xlarge
Resources/Values-large
Resources/Values-normal
Resources/Values-small
 
Each Styles.xml has entries like...
 

<

style name="NormText">

<

item name="android:textSize">16sp</item>

</

style>

<

style name="NormBtn">

<

item name="android:textSize">18sp</item>

<

item name="android:layout_height">wrap_content</item>

</

style>
This way I only need one Layout that references the style from the appropriate folder based on size.
 

<

Button

android:id="@+id/startBtn"

style="@style/NormBtn"

android:layout_width="fill_parent"

android:text="Start Location Service"

/>

 
Steve Sharrock
Architecture/Design/Programming
 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Goncalo Oliveira
Sent: Thursday, August 16, 2012 10:09 AM
To: Discussions related to Mono for Android
Subject: [mono-android] Screen sizes and layouts

Hi there,

The application I'm developing needs to support several different sizes, from Normal to Extra Large. I'm using sp for text size and dp for everything else, as recommended in android's best practices. The thing is... In many places the only thing that changes is the text size, and I really need to set a different size for each screen layout - unless I'm mistaken. This is kind of awful as I'll have to have layouts for every screen size, in some cases multiplied by orientation. So my question here is... isn't there some other way (easier one) for doing this?

I've looked at the text appearance flags, like ?android:attr/textAppearanceMedium but they look completely different across sizes, so that isn't good enough either.
I know this is not exactly Xamarin related, but Android, though... I'd appreciate some hints on "the best way" of doing this.

Cheers

--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid




--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Screen sizes and layouts

ledz
In reply to this post by mattleibow
I am using the designer (the pre-designer era was even worse - hail Xamarin designer), but it kind of bugs me having to do every little thing, even when the only difference is the text size. Like I said, supporting three screen sizes plus a few more for portrait/landscape layouts, it's just a cumbersome and error prone task. I'm gonna try Steve's approach to at least simplify the text part, as some layouts are really simple.

Thanks to both.
Cheers.


-- 
Gonçalo Oliveira 

On 16 August 2012 18:28, Matthew Leibowitz <[hidden email]> wrote:
Using the Xamarin designer really helps. All you have to do is open the base layout and then switch to the other sizes from the drop down.
If you have the various locks on, it keeps track of which settings are changed on which screen size. It even asks you if you want to apply those changes to the other screen sizes.

On Thu, Aug 16, 2012 at 7:09 PM, Goncalo Oliveira <[hidden email]> wrote:
Hi there,

The application I'm developing needs to support several different sizes, from Normal to Extra Large. I'm using sp for text size and dp for everything else, as recommended in android's best practices. The thing is... In many places the only thing that changes is the text size, and I really need to set a different size for each screen layout - unless I'm mistaken. This is kind of awful as I'll have to have layouts for every screen size, in some cases multiplied by orientation. So my question here is... isn't there some other way (easier one) for doing this?

I've looked at the text appearance flags, like ?android:attr/textAppearanceMedium but they look completely different across sizes, so that isn't good enough either.
I know this is not exactly Xamarin related, but Android, though... I'd appreciate some hints on "the best way" of doing this.

Cheers

--
Gonçalo Oliveira

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid



_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid





_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Loading...