How to hide ActionBar in Scroll View in Sketchware

com.google.android.material.appbar.AppBarLayout.LayoutParams params = (com.google.android.material.appbar.AppBarLayout.LayoutParams)_toolbar.getLayoutParams();
params.setScrollFlags(com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP);


androidx.core.widget.NestedScrollView nestedScrollView = new androidx.core.widget.NestedScrollView(this);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
nestedScrollView.setLayoutParams(layoutParams);
nestedScrollView.setBackgroundColor(Color.WHITE);
((ViewGroup)linear2.getParent()).removeView(linear2);
linear1.removeAllViews();
linear1.addView(nestedScrollView);
nestedScrollView.addView(linear2);


/*

LinearLayout linear = new LinearLayout(this);
LinearLayout.LayoutParams linearParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
linear.setOrientation(LinearLayout.VERTICAL);
linear.setLayoutParams(linearParams);
nestedScrollView.addView(linear);


TextView textView = new TextView(this);
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(textParams);
textView.setText(txt);
textView.setPadding(15, 15, 15, 15);
linear.addView(textView);

*/



Comments

Popular posts from this blog

How to Create Material Ripple Effect in Sketchware

How to Create Custom Notifications with Listeners

How to create Custom Dialog in Sketchware