[Mono-bugs] [Bug 647561] New: Custom components from xml layouts don't show the view that was inflated

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 18 21:46:22 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=647561

https://bugzilla.novell.com/show_bug.cgi?id=647561#c0


           Summary: Custom components from xml layouts don't show the view
                    that was inflated
    Classification: Mono
           Product: MonoDroid
           Version: unspecified
          Platform: 64bit
        OS/Version: Windows 7
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: bryancostanich at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer
           Blocker: Yes


Created an attachment (id=395559)
 --> (http://bugzilla.novell.com/attachment.cgi?id=395559)
repro project

If you define a custom component that has it's layout defined in an xml file,
when you use that custom component, the view doesn't actually get inflated.

for instance, let's say you have the following layout called
custom_component.xml in the drawable directory:

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="60px" android:layout_gravity="center_horizontal">
  <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="1321464"/>
  <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="2"/>
</LinearLayout>

and then i have a custom component class that has the following init method:


        protected void Init(Context context)
        {
            LayoutInflater layoutInflater =
(LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
            this._view =
layoutInflater.Inflate(Resource.drawable.custom_component, this, true) as
ViewGroup;
        }

then, in my main.xml, i have the following:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="60px"
android:layout_gravity="center_horizontal">
    <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="test line 1"/>
    <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="test line 2"/>
  </LinearLayout>
  <test_CustomComponent.CustomComponent android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>


my custom component should get rendered, but it's not.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list