[android-developers] Re: Picture and Buttons for different screen size

2008-03-26 Thread vitvikt

Thanks, Megha

> The QVGA-L and QVGA-P modes are not supported in the m5 SDK. Your
> application may still use them, but may face some issues with layout.
> It is recommended  to use HVGA-L and HVGA-P modes.
I used it only for test. Do you know about another emulators with
another screen size?


> You can set the layout_height programatically using the LayoutParams
> class.http://code.google.com/android/reference/android/widget/LinearLayout
Thanks. I did it.

>  If you want to do this programatically, try using the constructor:
>  ProgressDialog pd = new ProgressDialog(this,
> android.R.styleable.Theme_progressBarStyleHorizontal);
I couldn't do it. OK. Now I decided forget about ProgressBar.
I used ProgressBar and ProgressDialog at the same time, when I used
xml layouts, but now I decided  use only ProgressDialog, if it is so
difficult or unimpossible to create ProgressBar programmly.

Thank you very much.
Vitaly
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Picture and Buttons for different screen size

2008-03-25 Thread Megha Joshi
On Tue, Mar 25, 2008 at 2:43 AM, vitvikt <[EMAIL PROTECTED]> wrote:

>
> Thanks, Megha
> I was very glad to get your answer.
> But your examle did not solve the problem.
>
> 1. In this example first button occupies 75% of the
> space and the other one occupies 25% in HWGA screen.
> In QVGA-P screen first button occupies 66% of the
> space and the other one occupies 33%.
> I changed layout_weight for both buttons, but could't get 9/1.
> I think that in this way I can not get button with height less then
> fix value.


The QVGA-L and QVGA-P modes are not supported in the m5 SDK. Your
application may still use them, but may face some issues with layout.
It is recommended  to use HVGA-L and HVGA-P modes.


>
> 2. I got  9/1 only when I set layout_height for second button near
> 15px.
> But in this case it is nessary to have possibility change this value
> programatically.


You can set the layout_height programatically using the LayoutParams class.
http://code.google.com/android/reference/android/widget/LinearLayout.LayoutParams.html

button.setLayoutParams(new
LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));



>
> 3. In my project I have (in LinearLayout with vertical orientation)
> Picture, horizontal ProgressBar and 5 buttons.
> I insert each of them in separate LinearLayout and set  layout_weight
> for each of LinearLayout 0.8   :0.1. : 0.1
> LinearLayout for buttons has orientation="horizontal" and I set for
> each of fife buttons layout_weight=0.2
> But in result first button have width less then another. Do you know
> what is a reason?


I am not sure, what is the layout_width on these buttons?


> 4. Yesterday, before I got your answer, I try do all programatically.
> I solve problem with Picture and buttons, but I couldn't set style="?
> android:attr/progressBarStyleHorizontal" for  ProgressBar. Is all so
> sofisticated in Android SDK or it's only my problem?
> All examples in ApiDemo use only xml layouts, so little explains in
> docs and decisions are not obvious.


In xml you could use :

 


 If you want to do this programatically, try using the constructor:

 ProgressDialog pd = new ProgressDialog(this,
android.R.styleable.Theme_progressBarStyleHorizontal);



>
> Regards,
> Vitaly
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Picture and Buttons for different screen size

2008-03-25 Thread vitvikt

Thanks, Megha
I was very glad to get your answer.
But your examle did not solve the problem.

1. In this example first button occupies 75% of the
space and the other one occupies 25% in HWGA screen.
In QVGA-P screen first button occupies 66% of the
space and the other one occupies 33%.
I changed layout_weight for both buttons, but could't get 9/1.
I think that in this way I can not get button with height less then
fix value.

2. I got  9/1 only when I set layout_height for second button near
15px.
But in this case it is nessary to have possibility change this value
programatically.

3. In my project I have (in LinearLayout with vertical orientation)
Picture, horizontal ProgressBar and 5 buttons.
I insert each of them in separate LinearLayout and set  layout_weight
for each of LinearLayout 0.8   :0.1. : 0.1
LinearLayout for buttons has orientation="horizontal" and I set for
each of fife buttons layout_weight=0.2
But in result first button have width less then another. Do you know
what is a reason?

4. Yesterday, before I got your answer, I try do all programatically.
I solve problem with Picture and buttons, but I couldn't set style="?
android:attr/progressBarStyleHorizontal" for  ProgressBar. Is all so
sofisticated in Android SDK or it's only my problem?
All examples in ApiDemo use only xml layouts, so little explains in
docs and decisions are not obvious.

Regards,
Vitaly
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Picture and Buttons for different screen size

2008-03-24 Thread Megha Joshi
Hi Vitaly,

You can set the layout weights using xml only, you do not need to do this
programatically, though you could if you wanted to.

To demonstrate how to do this:
1) Create a new test application and update your main.xml with the following
code:
 
 http://schemas.android.com/apk/res/android";
   android:orientation="vertical"

android:layout_width="wrap_content"
   android:layout_height="fill_parent"
   android:layout_weight="1.0"

   >


   

   

2) Run your application and see how the first button occupies 90% of the
space and the other one occupies 10% of the screen space.
3) Change the Layout_weight of both the buttons to "0.5" and run your
application to see what happens. You can play around with it to understand
the concept.

Thanks,
Megha

On Mon, Mar 24, 2008 at 4:18 AM, vitvikt <[EMAIL PROTECTED]> wrote:

>
> Thanks, Megha
>
> But not all is clear for me.
> I did not understand, is it sufficient use only xml layouts or I have
> to change layouts in programm (in java text)?
> Using only xml layouts dosn't give me desired result.
> If I have to change layouts in programm, I don't now how can I replace
> constructions in xml
>
>android:layout_width="fill_parent"
>android:layout_weight="0"
>android:layout_height="wrap_content">
>android:id="@+id/ww"
>android:layout_width="fill_parent"
>android:layout_height="300px"/>
>
> to construction in java text. This cnstruction I got from Snake
> example.
> In forum I find examples of creation LinearLayout, but how can I
> transform
>
>android:id="@+id/ww"
>android:layout_width="fill_parent"
>android:layout_height="300px"/>
>
> to java text?
> Now I have
> mWwView = (WWView) findViewById(R.id.ww);
>
> Thanks,
> Vitaly
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Picture and Buttons for different screen size

2008-03-24 Thread vitvikt

Thanks, Megha

But not all is clear for me.
I did not understand, is it sufficient use only xml layouts or I have
to change layouts in programm (in java text)?
Using only xml layouts dosn't give me desired result.
If I have to change layouts in programm, I don't now how can I replace
constructions in xml




to construction in java text. This cnstruction I got from Snake
example.
In forum I find examples of creation LinearLayout, but how can I
transform

android:id="@+id/ww"
android:layout_width="fill_parent"
android:layout_height="300px"/>

to java text?
Now I have
mWwView = (WWView) findViewById(R.id.ww);

Thanks,
Vitaly


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Picture and Buttons for different screen size

2008-03-23 Thread Megha Joshi
Hi,

You should use LinearLayout, and the layout_weight attribute of the
LinearLayout.LayoutParams on your views to define who much space they
occupy.
For your case you could set the layout_weight of your picture view to 1 and
the layout_weight of your button view to 0.
http://code.google.com/android/reference/android/widget/LinearLayout.LayoutParams.html#attr_android:layout_weight

To divide the space between multiple views you could use different values of
layout_weight on each of your views.

Thanks,
Megha

On 3/22/08, vitvikt <[EMAIL PROTECTED]> wrote:
>
>
> Hi!
> Can anybody answer me, how can I layout buttons under picture and get
> good result for different screen size?
> In onSizeChanged() I use screen size to modify my picture, but how can
> I set percent for picture view and buttons view? For example 90% for
> picture and 10% for buttons.
> Thank you.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---