2017-06-15 74 views
-1

我最近安装了Visual Studio与Xamarin,基本上在c#中制作android应用程序,但我遇到了问题。 当我尝试构建应用程序,显示窗是设计窗口不同: -> The Windows <-Visual Studio Android开发中的应用程序UI构建器不起作用

Main.axml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:minWidth="25px" 
    android:minHeight="25px"> 
    <Button 
     android:text="Button" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/button1" /> 
</LinearLayout> 

MainActivity.cs:

using Android.App; 
using Android.Widget; 
using Android.OS; 

namespace RemindMe 
{ 
    [Activity(Label = "RemindMe", MainLauncher = true, Icon = "@drawable/icon")] 
    public class MainActivity : Activity 
    { 
     protected override void OnCreate(Bundle bundle) 
     { 
      base.OnCreate(bundle); 

      // Set our view from the "main" layout resource 
      // SetContentView (Resource.Layout.Main); 
      Toast.MakeText(this.ApplicationContext, "Welcome! This app is currently under construction...", ToastLength.Short).Show(); 

     } 
    } 
} 
+0

也许您的Visible属性为false,请张贴您的代码以查找更多信息。 –

+0

axml文件? - 它的字面上只是一个按钮。 – Exus

+0

那里 - 更新它。 Theres没有太多虽然 – Exus

回答

0

你必须使用SetContentView (Resource.Layout.Main),此方法设置布局资源的活动内容。 Here是文档。

相关问题