how to set toolbar title when a text view hide from screen












0














How to implement that action which is shown in image



https://i.stack.imgur.com/MluU2.jpg










share|improve this question
























  • which action you want?
    – Jawad Malik
    Nov 12 at 19:37










  • @jawadmalik when page scroll and title hide it goes to the toolbar
    – Ali Ghafari
    Nov 12 at 20:06
















0














How to implement that action which is shown in image



https://i.stack.imgur.com/MluU2.jpg










share|improve this question
























  • which action you want?
    – Jawad Malik
    Nov 12 at 19:37










  • @jawadmalik when page scroll and title hide it goes to the toolbar
    – Ali Ghafari
    Nov 12 at 20:06














0












0








0







How to implement that action which is shown in image



https://i.stack.imgur.com/MluU2.jpg










share|improve this question















How to implement that action which is shown in image



https://i.stack.imgur.com/MluU2.jpg







android android-actionbar android-toolbar






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 20:11









Jawad Malik

317115




317115










asked Nov 12 at 19:31









Ali Ghafari

35




35












  • which action you want?
    – Jawad Malik
    Nov 12 at 19:37










  • @jawadmalik when page scroll and title hide it goes to the toolbar
    – Ali Ghafari
    Nov 12 at 20:06


















  • which action you want?
    – Jawad Malik
    Nov 12 at 19:37










  • @jawadmalik when page scroll and title hide it goes to the toolbar
    – Ali Ghafari
    Nov 12 at 20:06
















which action you want?
– Jawad Malik
Nov 12 at 19:37




which action you want?
– Jawad Malik
Nov 12 at 19:37












@jawadmalik when page scroll and title hide it goes to the toolbar
– Ali Ghafari
Nov 12 at 20:06




@jawadmalik when page scroll and title hide it goes to the toolbar
– Ali Ghafari
Nov 12 at 20:06












2 Answers
2






active

oldest

votes


















1














Use this piece of code to hide your layout



<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

</android.support.design.widget.AppBarLayout>

<!-- Your Remaining Code -->

</android.support.design.widget.CoordinatorLayout>





share|improve this answer





















  • you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
    – Vishal Sharma
    Nov 12 at 19:54










  • @vishalsharma of course but I don't know how should I do this
    – Ali Ghafari
    Nov 12 at 20:06



















0














Try using a collapsingToolbar layout. The material design example is found here but of significance is the below snippet



 <com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/shrine_toolbar_image_offset_top"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5"/>

<android.support.v7.widget.Toolbar
android:id="@+id/AppBar"
android:layout_width="match_parent"
android:layout_height="@dimen/shrine_toolbar_collapsed_height"
app:layout_collapseMode="pin"/>
</com.google.android.material.appbar.CollapsingToolbarLayout>





share|improve this answer





















    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%2f53268882%2fhow-to-set-toolbar-title-when-a-text-view-hide-from-screen%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Use this piece of code to hide your layout



    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.AppBarLayout>

    <!-- Your Remaining Code -->

    </android.support.design.widget.CoordinatorLayout>





    share|improve this answer





















    • you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
      – Vishal Sharma
      Nov 12 at 19:54










    • @vishalsharma of course but I don't know how should I do this
      – Ali Ghafari
      Nov 12 at 20:06
















    1














    Use this piece of code to hide your layout



    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.AppBarLayout>

    <!-- Your Remaining Code -->

    </android.support.design.widget.CoordinatorLayout>





    share|improve this answer





















    • you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
      – Vishal Sharma
      Nov 12 at 19:54










    • @vishalsharma of course but I don't know how should I do this
      – Ali Ghafari
      Nov 12 at 20:06














    1












    1








    1






    Use this piece of code to hide your layout



    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.AppBarLayout>

    <!-- Your Remaining Code -->

    </android.support.design.widget.CoordinatorLayout>





    share|improve this answer












    Use this piece of code to hide your layout



    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.AppBarLayout>

    <!-- Your Remaining Code -->

    </android.support.design.widget.CoordinatorLayout>






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 12 at 19:47









    Jawad Malik

    317115




    317115












    • you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
      – Vishal Sharma
      Nov 12 at 19:54










    • @vishalsharma of course but I don't know how should I do this
      – Ali Ghafari
      Nov 12 at 20:06


















    • you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
      – Vishal Sharma
      Nov 12 at 19:54










    • @vishalsharma of course but I don't know how should I do this
      – Ali Ghafari
      Nov 12 at 20:06
















    you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
    – Vishal Sharma
    Nov 12 at 19:54




    you need to make a toolbar like layout and add the item that you want and then you can hide and show the visibility according to your choice by using if else of particular textview or images.
    – Vishal Sharma
    Nov 12 at 19:54












    @vishalsharma of course but I don't know how should I do this
    – Ali Ghafari
    Nov 12 at 20:06




    @vishalsharma of course but I don't know how should I do this
    – Ali Ghafari
    Nov 12 at 20:06













    0














    Try using a collapsingToolbar layout. The material design example is found here but of significance is the below snippet



     <com.google.android.material.appbar.CollapsingToolbarLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:contentScrim="?attr/colorPrimary"
    app:expandedTitleGravity="top"
    app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
    app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
    app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

    <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/shrine_toolbar_image_offset_top"
    app:layout_collapseMode="parallax"
    app:layout_collapseParallaxMultiplier="0.5"/>

    <android.support.v7.widget.Toolbar
    android:id="@+id/AppBar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/shrine_toolbar_collapsed_height"
    app:layout_collapseMode="pin"/>
    </com.google.android.material.appbar.CollapsingToolbarLayout>





    share|improve this answer


























      0














      Try using a collapsingToolbar layout. The material design example is found here but of significance is the below snippet



       <com.google.android.material.appbar.CollapsingToolbarLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:contentScrim="?attr/colorPrimary"
      app:expandedTitleGravity="top"
      app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
      app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
      app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

      <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="@dimen/shrine_toolbar_image_offset_top"
      app:layout_collapseMode="parallax"
      app:layout_collapseParallaxMultiplier="0.5"/>

      <android.support.v7.widget.Toolbar
      android:id="@+id/AppBar"
      android:layout_width="match_parent"
      android:layout_height="@dimen/shrine_toolbar_collapsed_height"
      app:layout_collapseMode="pin"/>
      </com.google.android.material.appbar.CollapsingToolbarLayout>





      share|improve this answer
























        0












        0








        0






        Try using a collapsingToolbar layout. The material design example is found here but of significance is the below snippet



         <com.google.android.material.appbar.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleGravity="top"
        app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
        app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
        app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/shrine_toolbar_image_offset_top"
        app:layout_collapseMode="parallax"
        app:layout_collapseParallaxMultiplier="0.5"/>

        <android.support.v7.widget.Toolbar
        android:id="@+id/AppBar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/shrine_toolbar_collapsed_height"
        app:layout_collapseMode="pin"/>
        </com.google.android.material.appbar.CollapsingToolbarLayout>





        share|improve this answer












        Try using a collapsingToolbar layout. The material design example is found here but of significance is the below snippet



         <com.google.android.material.appbar.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleGravity="top"
        app:expandedTitleMarginStart="@dimen/shrine_toolbar_offset_start"
        app:expandedTitleMarginTop="@dimen/shrine_toolbar_offset_top"
        app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/shrine_toolbar_image_offset_top"
        app:layout_collapseMode="parallax"
        app:layout_collapseParallaxMultiplier="0.5"/>

        <android.support.v7.widget.Toolbar
        android:id="@+id/AppBar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/shrine_toolbar_collapsed_height"
        app:layout_collapseMode="pin"/>
        </com.google.android.material.appbar.CollapsingToolbarLayout>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 at 20:06









        clifford_owino

        170215




        170215






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f53268882%2fhow-to-set-toolbar-title-when-a-text-view-hide-from-screen%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







            Popular posts from this blog

            Bressuire

            Vorschmack

            Quarantine