Toolbar flickers when TableLayout setvisibility gone

  • Replies:0
Noman Uddin
  • Forum posts: 1

Aug 21, 2016, 2:10:02 PM via Website

I have a problem in android application. When I click on the screen to hide the toolbar it flickers. while disappearing it displays the content and then disappear.

Code:

content_main.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (toolbar.getVisibility()==View.GONE){
                toolbar.setVisibility(View.VISIBLE);
            }else{
                toolbar.setVisibility(View.GONE);
            }

Xml:

    <TableLayout ......."
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:rowCount="5"
    android:id="@+id/main_content"
    android:background="#000000"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="culha.roomdispaly.MainActivity"
    android:animateLayoutChanges="true"
    tools:showIn="@layout/activity_main">
   <TableRow
----------
      </TableRow>
</TableLayout>

Reply