Layout does not display content when loading through new activity in Xamarin

I am developing an application with Xamarin.

I have three actions: DiallerActivity , ContactsActivity and SplashActivity ; and two layouts .axml, Main.axml and Contacts.axml

SplashActivity is the first loaded screen that displays a popup when the application opens, when it loads DiallerActivity , which displays my Main.axml strong> layout - this works great.

In my layout Main.axml I have a button that when pressed loads ContactsActivity , which must then download Contacts.axml , which simply has 3 buttons and a label inside .. none of which has not been programmed for anything.

The problem is that when the button is pressed, the display switches to a blank screen, still showing the Android panel at the top of the screen. It just does not display the contents from the .axml file.

I need the Contacts.axml layout that will be displayed when this operation starts. Hope I made it clear. My current code is below.

Code for DiallerActivity

protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);

Button btnAcceptClick = FindViewById<Button> (Resource.Id.btnAccept);

btnAcceptClick.Click += delegate {
            StartActivity (typeof(VoWiFiApplicationFinal.ContactsActivity));
        };

Code for ContactActivity

public class ContactsActivity : Activity
{
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        // setting the contacts.axml as the view
        SetContentView (Resource.Layout.Contacts);
    }
}

- , Contact.axml ? , , , . # , , , , . .

Contacts.xaml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
    android:layout_width="fill_parent"
    android:id="@+id/toptest"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+/label1"
        android:text="testlabel" />
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:id="@+id/testagain"
    android:layout_height="wrap_content"
    android:orientation="horizontal" />
<LinearLayout
    android:layout_width="fill_parent"
    android:id="@+id/menuBar"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <Button
        android:layout_width="fill_parent"
        android:text="ACCEPT"
        android:id="@+id/btnAccep"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnDeclin"
        android:layout_weight="1"
        android:text="DECLINE" />
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btntes"
        android:layout_weight="1"
        android:text="TEST" />
</LinearLayout>
</LinearLayout>
+6
1

, Xamarin . ( ), .axml \strings.xml, , .axml. , - , , , - - .

,

  • .axml .
  • .axml , .
  • .
  • .

, .

0

All Articles