Question regarding linearlayout

by striverwang » Thu, 12 Mar 2009 01:24:31 GMT

Sponsored Links
I have a question regarding linearlayout(maybe other layout types)
|       textf             |button  |

I want to implement above layout, firstly to place a textfield on the
screen, and place a button on its right, the button's size is fixed,
and I want to textfield to fill the rest space of the row.

I want to use LinearLayout, but can not implement such UI.

Anyboday have suggestion? Thank you!


Question regarding linearlayout

by Romain Guy » Thu, 12 Mar 2009 01:28:05 GMT

 Give your button a width of wrap_content, your text field a width of
0dip and a weight of 1.

Romain Guy
Android framework engineer

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them


Sponsored Links

Question regarding linearlayout

by Dat Nguyen » Fri, 13 Mar 2009 01:47:13 GMT

 Why not trying RelativeLayout?You may use android:layout_toRightOf:
@id/textf  for the button.

Dat Nguyen.


Other Threads

1. Find whether trackball events ended or not


I want to move an image around the screen according to the trackball  
movement. I am able to capture the movements using the  
onTrackballEvent method. But this is being called for very small float  
values (I believe for each rotation?) of the trackball.

Now as X and Y positions of views should be integers when specifying  
with LayoutParams, it makes no sense to move the view with every  
rotation. Instead I want to move the view only after the user stops  
rotating the trackball.

Is there any method by which we can get whether the user stopped using  
the trackball or not?



2. How to achieve android project's Internationalization

> I want to make my android project Internationalization,but i don't


You do not create values-xx files, you create values-xx directories:

res/values (default, perhaps English)

Your code, in theory, does not need to change at all -- Android will
choose the right strings out of the strings.xml files in those

You *might* have to change your UI layouts somewhat if the translated
strings are significantly longer than the space you had set aside.
TextView's android:marquee attribute can help with this, by animating a
selected TextView to show a longer string in its entirety in a smaller

Mark Murphy (a Commons Guy)
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!


3. Is there any chance that there will be ADP2?

4. Sorry - NewB Q - Retreiving contacts database

5. Android instrumentation class : what is the concept ?

6. Getting Android Error - Unknown URI: content://media/external/images/media

7. Getting Android Error - Unknown URI: content://media/external/images/media