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);
>
> }
>
> }
>

--~--~---------~--~----~------------~-------~--~----~
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