In my App, there is an activity which has a layout as the one posted below. the problem I have is, when that activity starts, action bar becomes invisible, CoordinatorLayout takes up all the screen. What I am trying to do is that actionBAr should be visible. The action bar of the my App looks like the image shown in section "action bar" below.
To solve this problem I did the following:
i added "FloatingButtonTheme" to the styles.xml file as shown below in "styles.xml". and in the manifest file I added the following code:
<activity
android:name="x.xx.xxx.activity.ListeActivity"
android:theme="@style/FloatingButtonTheme">
but the result I got is that the activity takes up all the space on the screen with floating button appearing but the action bar is never there.
Please let me know how to force my action bar just as in picture below to show up?
Actually, this problem only appears when I use the
activity layout:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
tools:context=".activity.VersiecherungsListeActivity">
<include layout="@layout/versicherungslisteactivity_vers_view" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/versicherungslisteactivity_fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="10dp"
android:src="@android:drawable/ic_input_add"
app:backgroundTint="@color/light_orange" />
</android.support.design.widget.CoordinatorLayout>
action bar:
sytles:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
</style>
<style name="FloatingButtonTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
i just added android:theme="@style/Theme.AppCompat.Light.DarkActionBar" to the CoordinatorLayout as shown below:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.VersiecherungsListeActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<include layout="@layout/versicherungslisteactivity_vers_view" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/versicherungslisteactivity_fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="10dp"
android:src="@android:drawable/ic_input_add"
app:backgroundTint="@color/light_orange" />
</android.support.design.widget.CoordinatorLayout>