2016-05-26 12 views
0

Hallo, warum diese Leiste in meiner Aktivität versteckt ist? Das ist mein ScreenshotAndroid: Wie kann ich diese Leiste anzeigen und Symbole in der Symbolleiste hinzufügen?

enter image description here

Wie kann ich es sehen? und fügen Sie Icons und Titel in der Symbolleiste

diese meine Tätigkeit users.xml ist

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    xmlns:app="http://schemas.android.com/tools" 
    android:id="@+id/scrollView" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
     <include 
      layout="@layout/toolbar" 
      android:id="@+id/tb"> 
     </include> 
      <android.support.v7.widget.CardView 
       android:id="@+id/cardview1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       card_view:cardBackgroundColor="@android:color/white" 
       card_view:cardCornerRadius="8dp" 
       card_view:cardElevation="20dp" 
       android:layout_marginTop="10dp" 
       android:layout_marginRight="10dp" 
       android:layout_marginLeft="10dp"> 
       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical"> 
        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="50dp" 
         android:gravity="center_vertical" 
         android:background="@color/lignt_blue" 
         android:paddingLeft="25dp"> 
    .... 

Dies ist meine Tätigkeit users.java

public class Users extends AppCompatActivity { 
    private TextView editName; 
    private ImageView imageView1; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.users); 
    Intent intent = getIntent(); 
    String ref2 = intent.getStringExtra("ref"); 
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); 
    setSupportActionBar(myToolbar); 
     editName = (TextView) findViewById(R.id.editName); 
     imageView1= (ImageView)findViewById(R.id.imageView1); 
    } 

das ist mein toolbar.xml

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

Ihre Statusleiste wurde nicht ausgeblendet. Es verwendet die Farbe von Primarycolor, die in color.xml oder in styles.xml definiert ist. –

+0

Nein, meine Farbe ist blau # 3F51B5 mit

+0

können Sie posten Sie Ihre gesamten Styles xml. das könnte mir hilfreich sein –

Antwort

0

Von was ich recherchiert habe, müssen Sie vollständig im Vollbildmodus gehen, um es zu ändern.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 

Verwenden Sie den folgenden Code entweder den Status/Power Bar Sache (Sein Name ist mir) zu entfernen oder hinzufügen:

der Bar ausblenden:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 

Oder dies zu zeigen, bar:

Wenn das nicht das Problem ist, dann nimmt das Aussehen der Kommentare Ihrer Statusleiste die Farbe von die colorPrimaryDark.

Um dies zu beheben, ich würde versuchen, dies in Ihrem styles.xml zu verwenden:

<item name="android:colorPrimaryDark">@color/brand_color_dark</item> 

OR:

dies den

<item name="colorPrimary">@color/yourColor</item> 
<item name="colorPrimaryDark">@color/yourColor</item> 

styles.xml hinzufügen und diese dann entfernen Code aus Ihrer XML-Datei:

<item name="android:windowTranslucentStatus">true</item> 
<item name="android:fitsSystemWindows">true</item> 

Gib alle diese Methoden an und lass es mich wissen, wenn sie dein Problem lösen.