我在學習android並在項目上工作。我剛剛在android studio中創建了一個android項目,並試圖隱藏標題欄。更多我已經嘗試過所有的解決方案已經使用now.but它不工作。如何解決在android studio中隱藏標題欄問題?
我試過以下網站他們會爲此問題做些什麼解決方案。
http://stackoverflow.com/questions/28080250/android-feature-no-title-not-working
http://stackoverflow.com/questions/9737112/requestwindowfeaturewindow-feature-no-title-causing-the-app-to-crash
http://stackoverflow.com/questions/21354365/android-requestwindowfeaturewindow-feature-no-title-exception
http://stackoverflow.com/questions/27891030/requestwindowfeaturewindow-feature-no-title-error
http://stackoverflow.com/questions/25164171/requestwindowfeaturewindow-feature-no-title-not-working-in-froyo-and-gingerbr
http://stackoverflow.com/questions/25119013/can-not-remove-title-bar-in-activity#
這裏是我的Android清單文件
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.raju.androidpractice.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
我知道這非常非常基本的問題,但每當我搜索關於這個問題沒有正確的答案和解釋
很感激簡短的關於這個issue.Thanks事先預期的解決方案
嘗試更換'<樣式名稱= 「AppTheme」 父= 「Theme.AppCompat.Light.DarkActionBar」>''與<樣式名稱= 「AppTheme」 父=「Theme.AppCompat.DayNight.NoActionBar 「>' – SripadRaj
其不工作 – Raju