Just make your LinearLayout vertical.

On Fri, Mar 20, 2009 at 9:46 PM, Meryl Silverburgh
<[email protected]> wrote:
>
> Thank you.
> How can I lay out 1 label at a line? I try switching to
> RelativeLayout, it is still the same problem.
>
>
> On Fri, Mar 20, 2009 at 9:33 PM, Romain Guy <[email protected]> wrote:
>>
>> Your LinearLayout is horizontal and both your children are width=fill_parent.
>>
>> On Fri, Mar 20, 2009 at 9:30 PM, Meryl Silverburgh
>> <[email protected]> wrote:
>>>
>>> Romain,
>>>
>>> Thank you. But I change the height to wrap_content for both items.
>>> I still see only 1 item in the emulator.
>>>
>>> Any idea please?
>>>
>>>
>>> On Fri, Mar 20, 2009 at 8:48 PM, Romain Guy <[email protected]> wrote:
>>>>
>>>> You specified a height of fill_parent for both items. So they both
>>>> have the height of their parent. So the second one is outside of the
>>>> parent.
>>>>
>>>> On Fri, Mar 20, 2009 at 6:53 PM, Meryl Silverburgh
>>>> <[email protected]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>  I am trying to create a compound widget which has 2 labels (i.e.
>>>>>  textview), one label on each line.
>>>>>
>>>>>  public class TwoLabel extends LinearLayout {
>>>>>        private TextView mLabel;
>>>>>        private TextView mLabel2;
>>>>>
>>>>>  public TwoLabel(Context context, AttributeSet attrs, int defStyle) {
>>>>>                super(context, attrs, defStyle);
>>>>>
>>>>>        mLabel = new TextView(context, attrs, R.attr.textViewStyle);
>>>>>
>>>>>        mLabel2 = new TextView(context, attrs, R.attr.textViewStyle);
>>>>>
>>>>> mLabel.setLayoutParams(new
>>>>> LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
>>>>> LinearLayout.LayoutParams.FILL_PARENT));
>>>>>
>>>>>
>>>>> mLabel2.setLayoutParams(new
>>>>> LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
>>>>> LinearLayout.LayoutParams.FILL_PARENT));
>>>>>
>>>>>        addView(mLabel);
>>>>>        addView(mLabel2);
>>>>>  }
>>>>>
>>>>> My question is why I only see the first label but not the second label?
>>>>>
>>>>> In the layout.xml file which uses the TwoLabel compound widget, I did 
>>>>> this:
>>>>>
>>>>>       <TwoLabel
>>>>>                android:layout_width="fill_parent"
>>>>>                android:layout_height="fill_parent"
>>>>>                android:id="@+id/textFieldLabel"
>>>>>
>>>>>           />
>>>>>
>>>>> So I am not sure why I only see the first label but not the second one.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 20, 2009 at 6:50 PM, Meryl Silverburgh
>>>>> <[email protected]> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to create a compound widget which has 2 labels (i.e.
>>>>>> textview), one label on each line.
>>>>>>
>>>>>> public class TwoLabel extends LinearLayout {
>>>>>>        private TextView mLabel;
>>>>>>        private TextView mLabel2;
>>>>>>
>>>>>> public TwoLabel(Context context, AttributeSet attrs, int defStyle) {
>>>>>>                super(context, attrs, defStyle);
>>>>>>
>>>>>>        mLabel = new TextView(context, attrs, R.attr.textViewStyle);
>>>>>>
>>>>>>        mLabel2 = new TextView(context, attrs, R.attr.textViewStyle);
>>>>>>
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>
>>>>> >
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Romain Guy
>>>> Android framework engineer
>>>> [email protected]
>>>>
>>>> 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
>>>>
>>>> >
>>>>
>>>
>>> >
>>>
>>
>>
>>
>> --
>> Romain Guy
>> Android framework engineer
>> [email protected]
>>
>> 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
>>
>> >
>>
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to