Reputation: 417
I made a new android project with VS 2015 Enterprise and Xamarin and added some widgets to it. I'm getting an empty form every time build the project and run on a real android 4.4 device. using android 4.1 to compile.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:gridSpec="1|8|#0093eeff|K:#ee8700ff:16,l:72,l:16,r|S:#83ee00ff:16,0,l:16,56,l:16,0,r"
android:background="#9a50ea"
android:minWidth="25px"
android:minHeight="25px">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="10"
android:background="#9a50ea">
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="آگهی جدید"
android:id="@+id/button5"
android:layout_weight="20"
android:background="@android:color/transparent"
android:textColor="@android:color/white"
android:drawableRight="@drawable/ic_add_white_24dp"
android:clickable="true" />
<TextView
android:layout_width="0dip"
android:layout_height="match_parent"
android:text="صفحه اصلی"
android:id="@+id/button6"
android:layout_weight="35"
android:background="@android:color/transparent"
android:textColor="@android:color/white"
android:gravity="center_vertical"
fontPath="fonts/Shabnam.ttf" />
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_weight="10"
android:src="@drawable/logo"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="10"
android:gravity="right"
android:layout_gravity="right"
android:background="#9a50ea">
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="چسپ من"
android:id="@+id/button"
android:layout_weight="25"
android:drawableTop="@drawable/ic_person_white_24dp"
android:background="@android:color/transparent"
android:textColor="@android:color/white" />
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="جستجو"
android:id="@+id/button3"
android:layout_weight="25"
android:drawableTop="@drawable/ic_search_white_24dp"
android:background="@android:color/transparent"
android:textColor="@android:color/white" />
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="دستهبندیها"
android:id="@+id/button2"
android:layout_weight="25"
android:drawableTop="@drawable/ic_list_white_24dp"
android:background="@android:color/transparent"
android:textColor="@android:color/white" />
<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="صفحه اصلی"
android:id="@+id/button4"
android:layout_weight="25"
android:drawableTop="@drawable/ic_home_white_24dp"
android:background="@android:color/transparent"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Main activity file :
using Android.App;
using Android.Widget;
using Android.OS;
using Android.Graphics;
using UK.CO.Chrisjenx.Calligraphy;
namespace Chasp
{
[Activity(Label = "Chasp", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
}
}
}
Help/Xamarin/Open Logs file :
Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject Information: 0 : [2016-12-27 11:47:42.8980] designer model checker: DocumentSaved
Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject Information: 0 : [2016-12-27 11:48:01.0096] designer model checker: Build
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1106] Couldn't synchronize/copy Java.Interop.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1364] Couldn't synchronize/copy mscorlib.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1454] Couldn't synchronize/copy System.Collections.Concurrent.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1604] Couldn't synchronize/copy System.Collections.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1694] Couldn't synchronize/copy System.Core.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1774] Couldn't synchronize/copy System.Diagnostics.Debug.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1844] Couldn't synchronize/copy System.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.1934] Couldn't synchronize/copy System.Linq.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.2249] Couldn't synchronize/copy System.Reflection.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.2324] Couldn't synchronize/copy System.Reflection.Extensions.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.2399] Couldn't synchronize/copy System.Runtime.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.2479] Couldn't synchronize/copy System.Runtime.InteropServices.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Xamarin.VisualStudio.ActivationManager Error: 0 : [2016-12-27 11:48:01.2579] Couldn't synchronize/copy System.Threading.dll
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.AndroidDesigner.DesignerProject.SynchronizeDirectoryRecursive(String src, String dst)
Upvotes: 0
Views: 95
Reputation: 305
you have to set the layout as content in OnCreate Method after
base.OnCreate(bundle);
SetContentView (Resource.Layout.Main);
Upvotes: 0
Reputation: 34128
You still need to set the layout as content like:
[Activity(Label = "Chasp", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView (Resource.Layout.Main);
}
}
This loads your axml file and sets it as the content.
The reason this isn't done by default is probably because there are multiple ways to build your UI. You could also define it in code, maybe this default code is in another project template. Anyway, you probably won't forget this anytime soon!
Upvotes: 1