How can i remove the shadow of the toolbar?












0















I wanna remove the shadow or the line after the name of app
When i put that code


0dp
in XML i get the following error: invalid parent reference 'style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'.










share|improve this question























  • did you use the tabLayout?

    – user7268353
    Nov 16 '18 at 9:03











  • yes, i did that

    – Ahmed Zaki
    Nov 16 '18 at 9:16











  • so put your code plz to edit is

    – user7268353
    Nov 16 '18 at 12:32











  • I didn't know how can i put it on stackoverflow cos I'm newcomer here.

    – Ahmed Zaki
    Nov 19 '18 at 12:24
















0















I wanna remove the shadow or the line after the name of app
When i put that code


0dp
in XML i get the following error: invalid parent reference 'style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'.










share|improve this question























  • did you use the tabLayout?

    – user7268353
    Nov 16 '18 at 9:03











  • yes, i did that

    – Ahmed Zaki
    Nov 16 '18 at 9:16











  • so put your code plz to edit is

    – user7268353
    Nov 16 '18 at 12:32











  • I didn't know how can i put it on stackoverflow cos I'm newcomer here.

    – Ahmed Zaki
    Nov 19 '18 at 12:24














0












0








0








I wanna remove the shadow or the line after the name of app
When i put that code


0dp
in XML i get the following error: invalid parent reference 'style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'.










share|improve this question














I wanna remove the shadow or the line after the name of app
When i put that code


0dp
in XML i get the following error: invalid parent reference 'style/Widget.AppCompat.Light.ActionBar.Solid.Inverse'.







android-studio






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 8:14









Ahmed ZakiAhmed Zaki

11




11













  • did you use the tabLayout?

    – user7268353
    Nov 16 '18 at 9:03











  • yes, i did that

    – Ahmed Zaki
    Nov 16 '18 at 9:16











  • so put your code plz to edit is

    – user7268353
    Nov 16 '18 at 12:32











  • I didn't know how can i put it on stackoverflow cos I'm newcomer here.

    – Ahmed Zaki
    Nov 19 '18 at 12:24



















  • did you use the tabLayout?

    – user7268353
    Nov 16 '18 at 9:03











  • yes, i did that

    – Ahmed Zaki
    Nov 16 '18 at 9:16











  • so put your code plz to edit is

    – user7268353
    Nov 16 '18 at 12:32











  • I didn't know how can i put it on stackoverflow cos I'm newcomer here.

    – Ahmed Zaki
    Nov 19 '18 at 12:24

















did you use the tabLayout?

– user7268353
Nov 16 '18 at 9:03





did you use the tabLayout?

– user7268353
Nov 16 '18 at 9:03













yes, i did that

– Ahmed Zaki
Nov 16 '18 at 9:16





yes, i did that

– Ahmed Zaki
Nov 16 '18 at 9:16













so put your code plz to edit is

– user7268353
Nov 16 '18 at 12:32





so put your code plz to edit is

– user7268353
Nov 16 '18 at 12:32













I didn't know how can i put it on stackoverflow cos I'm newcomer here.

– Ahmed Zaki
Nov 19 '18 at 12:24





I didn't know how can i put it on stackoverflow cos I'm newcomer here.

– Ahmed Zaki
Nov 19 '18 at 12:24












1 Answer
1






active

oldest

votes


















0














You need to use toolbar widget to set the elevation same as your TabLayout, try to add toolbar above your TabLayout (im using LinearLayout) like this :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"/>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:elevation="4dp">

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RELIGIOUS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ANCIENT" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MUSEUMS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS" />
</android.support.design.widget.TabLayout>




also, you need new style to remove default toolbar, let say we have this new style



<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

// this 2 code to remove toolbar and we can use custom toolbar
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>


then use this style to your activity, example :



<activity android:name=".MainActivity"
android:theme="@style/AppThemeNoActionBar"> // this
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


last, define our new toolbar in activity.



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);


Hope it helps :)






share|improve this answer
























  • I wanna use to remove the shadow without removing default toolbar.

    – Ahmed Zaki
    Nov 19 '18 at 12:29











  • I mean if i can remove it in style XML file

    – Ahmed Zaki
    Nov 19 '18 at 12:31











  • I did every thing u tell me and i got error mess says view pager has stopped

    – Ahmed Zaki
    Nov 23 '18 at 22:29











  • What is the error says?

    – Erwin Kurniawan
    Nov 28 '18 at 4:40











  • view pager has stopped

    – Ahmed Zaki
    Dec 8 '18 at 9:41











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333844%2fhow-can-i-remove-the-shadow-of-the-toolbar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You need to use toolbar widget to set the elevation same as your TabLayout, try to add toolbar above your TabLayout (im using LinearLayout) like this :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"/>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:elevation="4dp">

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RELIGIOUS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ANCIENT" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MUSEUMS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS" />
</android.support.design.widget.TabLayout>




also, you need new style to remove default toolbar, let say we have this new style



<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

// this 2 code to remove toolbar and we can use custom toolbar
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>


then use this style to your activity, example :



<activity android:name=".MainActivity"
android:theme="@style/AppThemeNoActionBar"> // this
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


last, define our new toolbar in activity.



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);


Hope it helps :)






share|improve this answer
























  • I wanna use to remove the shadow without removing default toolbar.

    – Ahmed Zaki
    Nov 19 '18 at 12:29











  • I mean if i can remove it in style XML file

    – Ahmed Zaki
    Nov 19 '18 at 12:31











  • I did every thing u tell me and i got error mess says view pager has stopped

    – Ahmed Zaki
    Nov 23 '18 at 22:29











  • What is the error says?

    – Erwin Kurniawan
    Nov 28 '18 at 4:40











  • view pager has stopped

    – Ahmed Zaki
    Dec 8 '18 at 9:41
















0














You need to use toolbar widget to set the elevation same as your TabLayout, try to add toolbar above your TabLayout (im using LinearLayout) like this :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"/>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:elevation="4dp">

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RELIGIOUS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ANCIENT" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MUSEUMS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS" />
</android.support.design.widget.TabLayout>




also, you need new style to remove default toolbar, let say we have this new style



<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

// this 2 code to remove toolbar and we can use custom toolbar
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>


then use this style to your activity, example :



<activity android:name=".MainActivity"
android:theme="@style/AppThemeNoActionBar"> // this
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


last, define our new toolbar in activity.



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);


Hope it helps :)






share|improve this answer
























  • I wanna use to remove the shadow without removing default toolbar.

    – Ahmed Zaki
    Nov 19 '18 at 12:29











  • I mean if i can remove it in style XML file

    – Ahmed Zaki
    Nov 19 '18 at 12:31











  • I did every thing u tell me and i got error mess says view pager has stopped

    – Ahmed Zaki
    Nov 23 '18 at 22:29











  • What is the error says?

    – Erwin Kurniawan
    Nov 28 '18 at 4:40











  • view pager has stopped

    – Ahmed Zaki
    Dec 8 '18 at 9:41














0












0








0







You need to use toolbar widget to set the elevation same as your TabLayout, try to add toolbar above your TabLayout (im using LinearLayout) like this :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"/>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:elevation="4dp">

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RELIGIOUS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ANCIENT" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MUSEUMS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS" />
</android.support.design.widget.TabLayout>




also, you need new style to remove default toolbar, let say we have this new style



<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

// this 2 code to remove toolbar and we can use custom toolbar
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>


then use this style to your activity, example :



<activity android:name=".MainActivity"
android:theme="@style/AppThemeNoActionBar"> // this
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


last, define our new toolbar in activity.



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);


Hope it helps :)






share|improve this answer













You need to use toolbar widget to set the elevation same as your TabLayout, try to add toolbar above your TabLayout (im using LinearLayout) like this :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"/>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray"
app:tabIndicatorColor="@android:color/white"
app:tabIndicatorHeight="2dp"
android:elevation="4dp">

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RELIGIOUS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ANCIENT" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MUSEUMS" />

<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS" />
</android.support.design.widget.TabLayout>




also, you need new style to remove default toolbar, let say we have this new style



<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

// this 2 code to remove toolbar and we can use custom toolbar
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>


then use this style to your activity, example :



<activity android:name=".MainActivity"
android:theme="@style/AppThemeNoActionBar"> // this
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


last, define our new toolbar in activity.



Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);


Hope it helps :)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 17 '18 at 12:29









Erwin KurniawanErwin Kurniawan

19018




19018













  • I wanna use to remove the shadow without removing default toolbar.

    – Ahmed Zaki
    Nov 19 '18 at 12:29











  • I mean if i can remove it in style XML file

    – Ahmed Zaki
    Nov 19 '18 at 12:31











  • I did every thing u tell me and i got error mess says view pager has stopped

    – Ahmed Zaki
    Nov 23 '18 at 22:29











  • What is the error says?

    – Erwin Kurniawan
    Nov 28 '18 at 4:40











  • view pager has stopped

    – Ahmed Zaki
    Dec 8 '18 at 9:41



















  • I wanna use to remove the shadow without removing default toolbar.

    – Ahmed Zaki
    Nov 19 '18 at 12:29











  • I mean if i can remove it in style XML file

    – Ahmed Zaki
    Nov 19 '18 at 12:31











  • I did every thing u tell me and i got error mess says view pager has stopped

    – Ahmed Zaki
    Nov 23 '18 at 22:29











  • What is the error says?

    – Erwin Kurniawan
    Nov 28 '18 at 4:40











  • view pager has stopped

    – Ahmed Zaki
    Dec 8 '18 at 9:41

















I wanna use to remove the shadow without removing default toolbar.

– Ahmed Zaki
Nov 19 '18 at 12:29





I wanna use to remove the shadow without removing default toolbar.

– Ahmed Zaki
Nov 19 '18 at 12:29













I mean if i can remove it in style XML file

– Ahmed Zaki
Nov 19 '18 at 12:31





I mean if i can remove it in style XML file

– Ahmed Zaki
Nov 19 '18 at 12:31













I did every thing u tell me and i got error mess says view pager has stopped

– Ahmed Zaki
Nov 23 '18 at 22:29





I did every thing u tell me and i got error mess says view pager has stopped

– Ahmed Zaki
Nov 23 '18 at 22:29













What is the error says?

– Erwin Kurniawan
Nov 28 '18 at 4:40





What is the error says?

– Erwin Kurniawan
Nov 28 '18 at 4:40













view pager has stopped

– Ahmed Zaki
Dec 8 '18 at 9:41





view pager has stopped

– Ahmed Zaki
Dec 8 '18 at 9:41


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333844%2fhow-can-i-remove-the-shadow-of-the-toolbar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini