2

I have a custom view I am using on a different layout. However it will not preview on that screen. At run time it looks fine. I have tried also to define the height, and other combos. I would prefer to not use a merge tag. I have also tried the shown in tag.

My map fragment using the custom view

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    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:orientation="vertical"
    tools:context=".ui.main.MainActivity">

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/vehicle_selector"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="15dp"
        android:background="@color/white"
        />

    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

    <com.ppp.myview
        android:id="@+id/ouieuieui"
        android:layout_gravity="bottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        />

</FrameLayout>

which renders like

enter image description here

The myview. Though most taken out for posting on SO

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical"
        xmlns:android="http://schemas.android.com/apk/res/android"
        >

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginBottom="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginLeft="15dp"
            >


    ...

The view it self renders

enter image description here

I would expect that I would see both in the preview on the map fragment.

StarWind0
  • 1,554
  • 2
  • 17
  • 46
  • I have the same problem, question opened here: https://stackoverflow.com/questions/47452928/showing-right-layout-in-the-editor-for-custom-views-in-android-studio – Nicola Gallazzi Dec 19 '17 at 15:30

0 Answers0