Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

error in design mode for Layout.axml

alinjojobaalinjojoba INMember ✭✭

when wanna to show Layout1.axml in Android designer (in VS2010) i get this error :

The layout could not be loaded: Exception of type 'Xamarin.AndroidDesigner.DesignerException' was thrown.

Posts

  • alinjojobaalinjojoba INMember ✭✭

    hi,
    I am there with this error!!!
    Can anyone do that !!!!!!!

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    You have a syntax error in your layout. I'd suggest you fix it.

  • alinjojobaalinjojoba INMember ✭✭

    thanks !
    but there is no error and i can run that without error.
    but the designer gives error(but xml mode works correctly)

  • CheesebaronCheesebaron DKInsider, University mod

    Show us the XML and it will be easier for us to pinpoint your error.

  • alinjojobaalinjojoba INMember ✭✭

    <?xml version="1.0" encoding="utf-8"?>
    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fadeScrollbars="false"
    android:layout_gravity="right"

    >

    <TableLayout
       android:minWidth="25px"
       android:minHeight="25px"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="center_horizontal"
       android:id="@+id/tableLayout1">
      <TableRow
          android:id="@+id/tableRow1"
          android:layout_width="wrap_content"
          android:background="@android:drawable/bottom_bar"
          android:paddingLeft="1200px"
          >
        <EditText
             android:layout_width="115px"
             android:layout_height="wrap_content"
             android:id="@+id/txtName"
              />
        <TextView
            android:text="ردیف"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="50px"
            android:layout_height="20px"
            android:gravity="left"
            android:id="@+id/tvName" 
            />
        <EditText
            android:inputType="number"
            android:layout_width="115px"
            android:layout_height="wrap_content"
            android:id="@+id/txtAge"
             />
        <TextView
            android:text="شماره فاکتور"
    
            android:layout_width="50px"
            android:layout_height="20px"
    
            android:id="@+id/tvAge" />
    
    
      </TableRow>
      <TableRow
          android:background="@android:drawable/bottom_bar"
          android:id="@+id/tableRow2"
          android:layout_height="40dp"
          android:paddingLeft="1200px"
          >
        <EditText
                    android:layout_width="115px"
                    android:layout_height="wrap_content"
                    android:id="@+id/txtCountry"
                    />
        <TextView
            android:text="نوع :"
    
            android:layout_width="50px"
            android:layout_height="20px"
            android:id="@+id/tvCountry" />
        <EditText
                            android:layout_width="115px"
                            android:layout_height="wrap_content"
                            android:id="@+id/txtd"
                    />
        <TextView
            android:text="تاریخ روز :"
    
            android:layout_width="50px"
            android:layout_height="20px"
            android:id="@+id/tvd" />
      </TableRow>
      <!--<TableRow
          android:background="@drawable/errorbg"
          android:id="@+id/tableRow3">
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/tvMsg" />
      </TableRow>-->
    </TableLayout>
    
    
    
    <!--#region Header GridView-->
    <LinearLayout
                android:orientation="horizontal"
                android:minWidth="25px"
                android:minHeight="25px"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/llHeader"
                android:background="@drawable/bgh">
      <TextView
    
             android:layout_width="50px"
             android:layout_height="wrap_content"
             android:id="@+id/GridHeader_ff__Del"
             style="@style/HeaderText"
          />
      <TextView
             android:text="@string/ff_MablaghKol"
             android:layout_width="100px"
             android:layout_height="wrap_content"
             android:id="@+id/GridHeader_ff__MablaghKol"
             style="@style/HeaderText"
          />
      <TextView
          android:text="@string/ff_Fee"
          android:layout_width="100px"
          android:layout_height="wrap_content"
          android:id="@+id/GridHeader_ff__Fee"
          style="@style/HeaderText"/>
    
    
    
      <TextView
            android:text="@string/ff_AmountKol"
            android:layout_width="100px"
            android:layout_height="wrap_content"
            android:id="@+id/GridHeader_ff__AmountKol"
            style="@style/HeaderText"
        />
      <TextView
              android:text="@string/ff_Vahed"
              android:layout_width="100px"
              android:layout_height="wrap_content"
              android:id="@+id/GridHeader_ff__Vahed"
              style="@style/HeaderText"
          />
      <TextView
          android:text="@string/ff_Amount"
          android:layout_width="100px"
          android:layout_height="wrap_content"
          android:id="@+id/GridHeader_ff__Amount"
          style="@style/HeaderText"/>
    
    
    
      <TextView
            android:text="@string/ff_Desc"
            android:layout_width="100px"
            android:layout_height="wrap_content"
            android:id="@+id/GridHeader_ff__Desc"
            style="@style/HeaderText"
        />
      <TextView
              android:text="@string/ff_NameMajazeKala"
              android:layout_width="150px"
              android:layout_height="wrap_content"
              android:id="@+id/GridHeader_ff__NameMajazeKala"
              style="@style/HeaderText"
          />
      <TextView
          android:text="@string/ff_NameKala"
          android:layout_width="150px"
          android:layout_height="wrap_content"
          android:id="@+id/GridHeader_ff__NameKala"
          style="@style/HeaderText"/>
    
    
    
      <TextView
            android:text="@string/ff_CodeFani"
            android:layout_width="100px"
            android:layout_height="wrap_content"
            android:id="@+id/GridHeader_ff__CodeFani"
            style="@style/HeaderText"
        />
      <TextView
              android:text="@string/ff_CodeKala"
              android:layout_width="100px"
              android:layout_height="wrap_content"
              android:id="@+id/GridHeader_ff__CodeKala"
              style="@style/HeaderText"
          />
      <TextView
          android:text="@string/ff_NameAnbar"
          android:layout_width="150px"
          android:layout_height="wrap_content"
          android:id="@+id/GridHeader_ff__NameAnbar"
          style="@style/HeaderText"/>
    
    
    
      <TextView
            android:text="@string/ff_CodeAnbar"
            android:layout_width="100px"
            android:layout_height="wrap_content"
            android:id="@+id/GridHeader_ff__CodeAnbar"
            style="@style/HeaderText"
        />
      <TextView
              android:text="@string/ff_Row"
              android:layout_width="50px"
              android:layout_height="wrap_content"
              android:id="@+id/GridHeader_ff__Row"
              style="@style/HeaderText"
          />
    
    </LinearLayout>
    <ListView
          android:minWidth="25px"
          android:minHeight="25px"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:fastScrollEnabled="true"
          android:id="@+id/gvFactor" />
    <!--#endregion-->
    


  • rmaciasrmacias USBeta, University ✭✭✭✭✭
    edited July 2013

    Well, like I said fix your syntax error. You don't have a </HorizontalScrollView> closing tag. And even then, you an only contain one child in a HorizontalScrollView. I don't know the look you're trying to achieve, but anything your want in your HorizontalScrollView should be wrapped behind a LinearLayout or equivalent.

    Example:

    <?xml version="1.0" encoding="utf-8"?> 
    <HorizontalScrollView>
    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">
    
      <!-- Your stuff here -->
    </LinearLayout>
    </HorizontalScrollView>
    
  • alinjojobaalinjojoba INMember ✭✭

    the code was not compeletly copied here!
    this is the code :

    
    
    <?xml version="1.0" encoding="utf-8"?>
     
      <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/scroll"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:fadeScrollbars="false"
      android:layout_gravity="right"
                         
    >
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    
          <RelativeLayout
         android:id="@+id/main"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
           >
    
            <LinearLayout
                     android:orientation="horizontal"
                     android:minWidth="25px"
                     android:minHeight="25px"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
                     android:id="@+id/eee"
                     android:background="@drawable/bgh"
                     android:paddingLeft="1200px">
              <EditText
                         android:layout_width="115px"
                         android:layout_height="wrap_content"
                         android:id="@+id/txtName"
                  >
              <TextView
          android:text="ردیف"
          android:textAppearance="?android:attr/textAppearanceSmall"
          android:layout_width="50px"
          android:layout_height="20px"
          android:gravity="left"
          android:id="@+id/tvName"
                >
              <EditText
                  android:inputType="number"
                  android:layout_width="115px"
                  android:layout_height="wrap_content"
                  android:id="@+id/txtAge"
                 >
              <TextView
                  android:text="شماره فاکتور"
                 
                  android:layout_width="50px"
                  android:layout_height="20px"
                
                  android:id="@+id/tvAge" >
    
            </LinearLayout>
    
          </RelativeLayout>
    
    
          <!--<TableLayout
           android:minWidth="25px"
           android:minHeight="25px"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:layout_gravity="center_horizontal"
           android:id="@+id/tableLayout1">
          <TableRow
              android:id="@+id/tableRow1"
              android:layout_width="wrap_content"
              android:background="@android:drawable/bottom_bar"
              android:paddingLeft="1200px"
              >
            <EditText
                 android:layout_width="115px"
                 android:layout_height="wrap_content"
                 android:id="@+id/txtName"
                  >
            <TextView
                android:text="ردیف"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:layout_width="50px"
                android:layout_height="20px"
                android:gravity="left"
                android:id="@+id/tvName" 
                >
            <EditText
                android:inputType="number"
                android:layout_width="115px"
                android:layout_height="wrap_content"
                android:id="@+id/txtAge"
                 >
            <TextView
                android:text="شماره فاکتور"
                 
                android:layout_width="50px"
                android:layout_height="20px"
                
                android:id="@+id/tvAge" >
    
    
          </TableRow>
          <TableRow
              android:background="@android:drawable/bottom_bar"
              android:id="@+id/tableRow2"
              android:layout_height="40dp"
              android:paddingLeft="1200px"
              >
            <EditText
                        android:layout_width="115px"
                        android:layout_height="wrap_content"
                        android:id="@+id/txtCountry"
                        >
            <TextView
                android:text="نوع :"
                 
                android:layout_width="50px"
                android:layout_height="20px"
                android:id="@+id/tvCountry" >
            <EditText
                                android:layout_width="115px"
                                android:layout_height="wrap_content"
                                android:id="@+id/txtd"
                        >
            <TextView
                android:text="تاریخ روز :"
                
                android:layout_width="50px"
                android:layout_height="20px"
                android:id="@+id/tvd" >
          </TableRow>
          -->
          <!--<TableRow
              android:background="@drawable/errorbg"
              android:id="@+id/tableRow3">
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tvMsg" >
          </TableRow>-->
          <!--
        </TableLayout>-->
    
    
    
          <!--#region Header GridView-->
          <LinearLayout
                      android:orientation="horizontal"
                      android:minWidth="25px"
                      android:minHeight="25px"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:id="@+id/llHeader"
                      android:background="@drawable/bgh">
            <TextView
                  
                   android:layout_width="50px"
                   android:layout_height="wrap_content"
                   android:id="@+id/GridHeader_ff__Del"
                   style="@style/HeaderText"
              >
            <TextView
                   android:text="@string/ff_MablaghKol"
                   android:layout_width="100px"
                   android:layout_height="wrap_content"
                   android:id="@+id/GridHeader_ff__MablaghKol"
                   style="@style/HeaderText"
              >
            <TextView
                android:text="@string/ff_Fee"
                android:layout_width="100px"
                android:layout_height="wrap_content"
                android:id="@+id/GridHeader_ff__Fee"
                style="@style/HeaderText">
    
    
    
            <TextView
                  android:text="@string/ff_AmountKol"
                  android:layout_width="100px"
                  android:layout_height="wrap_content"
                  android:id="@+id/GridHeader_ff__AmountKol"
                  style="@style/HeaderText"
            >
            <TextView
                    android:text="@string/ff_Vahed"
                    android:layout_width="100px"
                    android:layout_height="wrap_content"
                    android:id="@+id/GridHeader_ff__Vahed"
                    style="@style/HeaderText"
              >
            <TextView
                android:text="@string/ff_Amount"
                android:layout_width="100px"
                android:layout_height="wrap_content"
                android:id="@+id/GridHeader_ff__Amount"
                style="@style/HeaderText">
    
    
    
            <TextView
                  android:text="@string/ff_Desc"
                  android:layout_width="100px"
                  android:layout_height="wrap_content"
                  android:id="@+id/GridHeader_ff__Desc"
                  style="@style/HeaderText"
            >
            <TextView
                    android:text="@string/ff_NameMajazeKala"
                    android:layout_width="150px"
                    android:layout_height="wrap_content"
                    android:id="@+id/GridHeader_ff__NameMajazeKala"
                    style="@style/HeaderText"
              >
            <TextView
                android:text="@string/ff_NameKala"
                android:layout_width="150px"
                android:layout_height="wrap_content"
                android:id="@+id/GridHeader_ff__NameKala"
                style="@style/HeaderText">
    
    
    
            <TextView
                  android:text="@string/ff_CodeFani"
                  android:layout_width="100px"
                  android:layout_height="wrap_content"
                  android:id="@+id/GridHeader_ff__CodeFani"
                  style="@style/HeaderText"
            >
            <TextView
                    android:text="@string/ff_CodeKala"
                    android:layout_width="100px"
                    android:layout_height="wrap_content"
                    android:id="@+id/GridHeader_ff__CodeKala"
                    style="@style/HeaderText"
              >
            <TextView
                android:text="@string/ff_NameAnbar"
                android:layout_width="150px"
                android:layout_height="wrap_content"
                android:id="@+id/GridHeader_ff__NameAnbar"
                style="@style/HeaderText">
    
    
    
            <TextView
                  android:text="@string/ff_CodeAnbar"
                  android:layout_width="100px"
                  android:layout_height="wrap_content"
                  android:id="@+id/GridHeader_ff__CodeAnbar"
                  style="@style/HeaderText"
            >
            <TextView
                    android:text="@string/ff_Row"
                    android:layout_width="50px"
                    android:layout_height="wrap_content"
                    android:id="@+id/GridHeader_ff__Row"
                    style="@style/HeaderText"
              >
    
          </LinearLayout>
          <ListView
                android:minWidth="25px"
                android:minHeight="25px"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:fastScrollEnabled="true"
                android:id="@+id/gvFactor" >
          <!--#endregion-->
    
        </LinearLayout> 
      </HorizontalScrollView>
    
    
    
    
    
  • FZelleFZelle DEMember ✭✭✭

    Please do yourself a favor and stop messing in axml files with comments.
    If you need to take something out, rely on sourcecontrol ( git/svn...).

    As rmacias allready said, the whole xml is not correct.
    Nearly all of your elements have no closing element.

    Your last Listview is

    <ListView
            android:minWidth="25px"
            android:minHeight="25px"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:fastScrollEnabled="true"
            android:id="@+id/gvFactor" >
    

    it should be

    <ListView
            android:minWidth="25px"
            android:minHeight="25px"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:fastScrollEnabled="true"
            android:id="@+id/gvFactor" />
    

    See the difference?

  • alinjojobaalinjojoba INMember ✭✭

    thanks.
    but i cannot copy completetly.
    all have closing tag!

    i have new project without any thing (all default) but the same it give the same error?
    Thanks in advanced!

  • VladimirFuminVladimirFumin RUMember ✭✭

    I have same error in new created empty android application. Does somebody resolve this error? Also i can't see source code of layout.

  • monsterralphmonsterralph USMember

    make sure in the drawable folder there are no other type of files in it, i,e .psd or .ai ,mine had the same problem until i moved the adobe illustrator file in the drawable folder

  • JSourpJSourp USMember ✭✭

    I assume the OP has already solved his issue, but for others that may have the same issue and the above did not solve it for them (like myself)...

    There are several ways one could get this non-descriptive error. Typically it is going to be a related to invalid xml. The way that I tracked down the cause of the issue was by removing sections that I felt could be the related (new sections since it last worked correctly) until it worked. I did this until I isolated the single component that caused the issue.

    In my particular circumstance, I set 'android:orientation="horizontal"' when is was supposed to be 'android:orientation="vertical"' like it's surrounding LinearLayout sections. This was a copy/paste issue on my end.

    Hope this helps.

  • JSourpJSourp USMember ✭✭

    I also needed to change my Button 'layout_width' from 'fill_parent' to 'match_parent' and 'layout_height' from 'fill_parent' to 'wrap_content'.

Sign In or Register to comment.