• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android Preview screen shows android…coordinatorlayout

Novice needs help getting started. I am working through the book “Android Programming in Kotlin: Starting with an App.” This is my first program, and I just started Android Studio.

When I start an app in Android Studio 3.1.3 and select “Basic activity,” as instructed in the book, the Android Preview screen shows “android…CoordinatorLayout” instead of the Hello World! text that should be on the screen.

When I Run the App, it works in an emulator, showing the Hello World! text, but I cannot see the text on the xml file Design screen because it is grayed out and has the “android…CoordinatorLayout” text on it.

I read a forum entry somewhere that said I should use an “AppCompat” theme to fix this. I did that and the resulting screen is blank - I cannot see the Hello World! text in the xml file Design preview. “android…CoordinatorLayout” is gone, but there is no text in its place.

Here is the activity_main.xml file code, all of which was generated by Android Studio:


Code:
<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="[USER=19691]@Style[/USER]/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:attr/colorPrimary"
            app:popupTheme="[USER=19691]@Style[/USER]/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

Any help would be greatly appreciated. Thank you.
 
Last edited:
Hi. Welcome to Android Forums.
I moved your thread over to the Android Development forum, which is the place to ask app coding questions.

It would help to see your code, and other app resources, such as the layout XML file you're using. If you do include such information, please use the [code][/code] tags to format it nicely.

You may also wish to look at the sticky posts at the top of this forum, which contain some useful information and links for beginners. Although this information is focussed on the Java programming language.
 
Novice needs help getting started. I am working through the book “Android Programming in Kotlin: Starting with an App.” This is my first program, and I just started Android Studio.

When I start an app in Android Studio 3.1.3 and select “Basic activity,” as instructed in the book, the Android Preview screen shows “android…CoordinatorLayout” instead of the Hello World! text that should be on the screen.

When I Run the App, it works in an emulator, showing the Hello World! text, but I cannot see the text on the xml file Design screen because it is grayed out and has the “android…CoordinatorLayout” text on it.

I read a forum entry somewhere that said I should use an “AppCompat” theme to fix this. I did that and the resulting screen is blank - I cannot see the Hello World! text in the xml file Design preview. “android…CoordinatorLayout” is gone, but there is no text in its place.

Here is the activity_main.xml file code, all of which was generated by Android Studio:


Code:
<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="[USER=19691]@Style[/USER]/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?android:attr/colorPrimary"
            app:popupTheme="[USER=19691]@Style[/USER]/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

Any help would be greatly appreciated. Thank you.
 
I solved this problem by changing references to alpha3 in build.gradle(module) to alpha 1. Not a very elegant solution. And I still get a rendering error;

Failed to find style 'coordinatorLayoutStyle' in current theme

Still looking for how to fix that.
 

Thank you for your response. I did see that post; it's where I got the idea to change alpha3 to alpha1. I also tried adding the line:

Code:
<item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>

into my styles.xml file, as follows:

Code:
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="coordinatorLayoutStyle">@style/Widget.Design.CoordinatorLayout</item>
</style>

This generated another problem. "The @Style/..." portion generated a "cannot resolve symbol" error, which I am trying to learn more about.
 
Back
Top Bottom