5

मैं नई टूलबार का उपयोग कर रहा हूं और इसे समर्थन एक्शनबार के रूप में सेट कर रहा हूं। मेरी समस्या यह है कि यह मेरी सामग्री को कवर कर रहा है।एंड्रॉइड टूलबार सामग्री को कवर करना

यहां कोड है जिसे मैं टूलबार सेट अप करने के लिए उपयोग कर रहा हूं।

public void setupNavBar() { 
    mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); 
    if (mToolbar != null) { 
     setSupportActionBar(mToolbar); 

     mActionBar = getSupportActionBar(); 
     mActionBar.setDisplayShowHomeEnabled(true); 
     mActionBar.setDisplayShowTitleEnabled(false); 
    } 
} 

शैलियाँ:

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Customize your theme here. --> 
</style> 

<style name="ToolBarStyle" parent=""> 
    <item name="android:elevation">5dp</item> 
    <item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item> 
    <item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> 
</style> 

और लेआउट:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".MainActivity"> 

<android.support.v7.widget.Toolbar 
    style="@style/ToolBarStyle" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/material_blue_grey_800" 
    android:minHeight="@dimen/abc_action_bar_default_height_material" 
    android:id="@+id/toolbar_actionbar" 

    /> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#478" 
    android:text="@string/hello_world" /> 

मैंने सोचा था कि setSupportActionbar प्रणाली को फोन करके posi देखभाल करेगा टूलबार दृश्य के नीचे टयनिंग सामग्री लेकिन यह वह नहीं है जो मैं देख रहा हूं।

टूलबार का उपयोग करने का सही तरीका क्या है। मेरे पास कुछ गतिविधियां हैं जहां मैं टूलबार को इसके पीछे की सामग्री के साथ पारदर्शी होने के लिए चाहता हूं और अन्य जहां मैं इसे नीचे दी गई सामग्री के साथ अपारदर्शी होना चाहता हूं।

धन्यवाद

उत्तर

3

TextView में नीचे उपयोग

<TextView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="#478" 
android:text="@string/hello_world" 
android:layout_below="@+id/toolbar_actionbar" 
/> 
संबंधित मुद्दे