android hide actionbar code example
Example 1: android java remove action bar
ActionBar actionBar=getSupportActionBar();
actionBar.hide();
Example 2: android hide status bar and action bar daynamically
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
}
}
Example 3: hide elements android
android:visibility="gone" <-- hides
android:visibility="visible" <-- makes it visible
textView.setVisibility(View.GONE);
textView.setVisibility(View.VISIBLE);