I used to use Eclipse to write APP, but today I try to use Android Sutido to write APP. I need to hide the title bar in the APP and use a custom title bar. It turns out that using requestWindowFeature(window.feature_no_title) method has no effect, and the title is not hidden
public class TitlebarActivity extends AppCompatActivity
In Android Studio, activities inherit from AppCompatActivity by default, so the requestWindowFeature(window.feature_no_title) method fails.
There are two solutions
- > change AppCompatActivity to Activity, then requestWindowFeature(window.feature_no_title); Add the following code to the onCreate() method:
if (getSupportActionBar() != null){
getSupportActionBar().hide();
}
Now you can hide the title bar.
Read More:
- Android set request window feature( Window.FEATURE_ NO_ Title) invalid solution
- Error record: this.requestWindowFeature ( Window.FEATURE_ NO_ Title) error or no effect
- Request window feature for Android Development( Window.FEATURE_ NO_ Title) does not take effect
- Solution to error opening trace file: no such file or directory (2) in Android
- An error is reported for the new Android project. Rejecting re init on previously failed
- XML tag has empty body less… (Ctrl+F1) Reports empty tag body. The validation works in XML / JSP
- Get the startup activity of Android apk
- Eclipse package explorer related problems and Solutions
- Android has applied for permission and still prompts open failed: eacces (permission denied)
- Running bat batch file in background
- Execution failed for task ‘:app:processDebugManifest’
- Unknown error (SQLite code 14): could not open database (How to Fix)
- Solution to the error of @ resource annotation in eclipse spring
- An error occurred while collecting items to be installed
- Error: Error parsing D:\new_android\Android SDK\system-images\android-25\android-wear\armeabi-v7a\de
- Item exception: failed to get the required ADT version number from the SDK
- window.open () several ways to open windows
- Set code indent to space indent in eclipse
- The solution of multiple markers at this line @ override
- Android avoids memory leak: reasonable use of getcontext() and getapplication ()