Ich versuche, zwei Aktivitäten innerhalb einer Klasse zu erweitern. Ich weiß es nicht möglich ist, ich habe versucht, zwei verschiedene Klassen wie diese zu machen:C# Android: Fehlerklasse kann nicht mehrere Basisklassen haben: 'Android.Support.V7.App.ActionBarActivity' und 'TabHostAct'
[Activity(Label = "DLS", Theme = "@style/MyTheme", ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
public class ActProduct : ActionBarActivity, TabHostAct
{
base.OnCreate(savedInstanceState);
// Create your application here
SetContentView(Resource.Layout.layProduct);
mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
mLeftDrawer.Tag = 0;
SetSupportActionBar(mToolbar);
mLeftDataSet = new List<string>();
mLeftDataSet.Add("Login");
mLeftDataSet.Add("Camera");
mLeftDataSet.Add("Maps");
mLeftDataSet.Add("Product");
mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
mLeftDrawer.Adapter = mLeftAdapter;
mLeftDrawer.ItemClick += MenuListView_ItemClick;
mDrawerToggle = new MyActionBarDrawerToggle(
this, //Host Activity
mDrawerLayout, //DrawerLayout
Resource.String.openDrawer, //Opened Message
Resource.String.closeDrawer //Closed Message
);
mDrawerLayout.SetDrawerListener(mDrawerToggle);
SupportActionBar.SetHomeButtonEnabled(true);
SupportActionBar.SetDisplayShowTitleEnabled(true);
mDrawerToggle.SyncState();
}
public class TabHostAct : TabActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
CreateTab(typeof(ActProProduk), "Prod", "Product", Resource.Drawable.ic_tab_product);
CreateTab(typeof(ActProCustomer), "Cust", "Customer", Resource.Drawable.ic_tab_customer);
CreateTab(typeof(ActProPromo), "Promo", "Promotion", Resource.Drawable.ic_tab_promo);
}
private void CreateTab(Type activityType, string tag, string label, int drawableId)
{
var intent = new Intent(this, activityType);
intent.AddFlags(ActivityFlags.NewTask);
var spec = TabHost.NewTabSpec(tag);
var drawableIcon = Resources.GetDrawable(drawableId);
spec.SetIndicator(label, drawableIcon);
spec.SetContent(intent);
TabHost.AddTab(spec);
}
}
Hier ist mein .axml Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The Main Content View -->
<FrameLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginLeft="25dp">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
</LinearLayout>
</LinearLayout>
<!-- The Left Navigation Drawer -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#818181"
android:dividerHeight="1dp"
android:background="#E3F2FD" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
gibt es eine Lösung für mein Problem? Vielen Dank im Voraus.
'Ich weiß, dass es nicht möglich ist 'warum fragen Sie nach einer Lösung, wenn Sie bereits wissen, dass es keine gibt? – F43nd1r
Ich habe nie gesagt, dass ich bereits weiß, ob es keine Lösung für mein Problem gibt. Ich wollte einfach nur sagen, dass es mit meiner Methode nicht möglich war. Ich versuche Leute zu finden, die mir eine Lösung für mein Problem geben können. – ginsawamura