2017-07-20 5 views
0

Ich habe ein seltsames Problem auf Android, wenn ich auf Android-Emulator laufen Ich habe die unten schwarze Leiste über den Bildschirm laufen, tut es die Gleiches auf meinem physischen Gerät Samsung S8.Xamarin.Forms, Auf Android gibt es eine schwarze Leiste über den oberen Rand des Bildschirms

enter image description here

EDIT:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="za.co.cofairsoft.cof"> 
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="25" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<application android:label="[email protected]" android:icon="@drawable/icon"> 
    <meta-data android:name="android.max_aspect" android:value="2.1" /> 
</application> 
<supports-screens android:xlargeScreens="true" /> 

<?xml version="1.0" encoding="utf-8"?> 
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" 
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
xmlns:local="clr-namespace:COFATV2" 
x:Class="COFATV2.COFATV2Page"> 
<MasterDetailPage.Master> 
<local:MasterPage x:Name="masterPage" /> 
</MasterDetailPage.Master> 
<MasterDetailPage.Detail> 
    <NavigationPage> 
     <x:Arguments> 
      <local:UserInfo /> 
     </x:Arguments> 
    </NavigationPage> 
</MasterDetailPage.Detail> 

<?xml version="1.0" encoding="UTF-8"?> 
<resources> 
<style name="MyTheme" parent="MyTheme.Base"> 
</style> 
<!-- Base theme applied no matter what API --> 
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:--> 
    <item name="windowNoTitle">true</item> 
    <!--We will be using the toolbar so no need to show ActionBar--> 
    <item name="windowActionBar">false</item> 
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette--> 
    <!-- colorPrimary is used for the default action bar background --> 
    <item name="colorPrimary">#bf1f27</item> 
    <!-- colorPrimaryDark is used for the status bar --> 
    <item name="colorPrimaryDark">#BC0009</item> 
    <!-- colorAccent is used as the default value for colorControlActivated 
    which is used to tint widgets --> 
    <item name="colorAccent">#bf1f27</item> 
    <!-- You can also set colorControlNormal, colorControlActivated 
    colorControlHighlight and colorSwitchThumbNormal. --> 
    <item name="windowActionModeOverlay">true</item> 
    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item> 
</style> 
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog"> 
    <item name="colorAccent">#bf1f27</item> 
</style> 
<style name="splashscreen" parent="MyTheme.Base"> 
    <item name="android:windowBackground">@drawable/splash_centered</item> 
    <item name="android:windowNoTitle">true</item> 
</style> 

Unten ist meine Hauptaktivität

[Activity(Label = "COFATV2.Droid", Icon = "@drawable/icon", Theme = "@style/splashscreen", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 
{ 
    protected override void OnCreate(Bundle bundle) 
    { 
     TabLayoutResource = Resource.Layout.Tabbar; 
     ToolbarResource = Resource.Layout.Toolbar; 

     base.OnCreate(bundle); 

     global::Xamarin.Forms.Forms.Init(this, bundle); 

     LoadApplication(new App()); 
    } 

    public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) 
    { 
     PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); 
    } 
} 

EDIT:

Im Folgenden finden Sie Code auch in Tabbar und Toolbar unter Layout:

Tabbar:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/sliding_tabs" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="?attr/colorPrimary" 
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
app:tabIndicatorColor="@android:color/white" 
app:tabGravity="fill" 
app:tabMode="fixed" /> 

Toolbar:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/toolbar" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="?attr/colorPrimary" 
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 
+0

teilen Sie bitte xml Ihres Layouts – Taier

+0

Ohne Ihren XAML-Code können wir nicht einmal herausfinden, warum das so ist :) –

+0

Wir müssen Ihre xaml/cs-Seite sehen, um zu helfen. Scheint wie ein negativer oberer Rand. –

Antwort

0

Ich habe den Täter gefunden, die ich in meinem MainAvtivity bin

Theme = "@style/splashscreen" 

in meinem Artcode

<style name="splashscreen" parent="MyTheme.Base"> 
    <item name="android:windowBackground">@drawable/splash_centered</item> 
    <item name="android:windowNoTitle">true</item> 
</style> 

der Begrüßungsbildschirm Code aufrufen:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android" 
android:src="@drawable/COFATSPLASH" 
android:gravity="center" 
android:color="@android:color/white"/> 

Schwerkraft = "center" ist die Problem, ohne es funktioniert das Problem aber ist, dass mein Bild im Splashscreen zu groß und Warp ist.

nicht sicher, ob jemand irgendwelche Vorschläge hat.

+0

Hallo, ich wollte nur hinzufügen, dass ich das auflösen Problem, das durch den Begrüßungsbildschirm verursacht wurde, verwendete ich eine ** Layer-Liste ** mit einem weißen Hintergrund und das Bild in der Layerliste. –

Verwandte Themen