Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Studio layout editor cannot render custom views
    primarykey
    data
    text
    <p>In Android Studio, the layout editor cannot preview custom views in xml.</p> <p>Very simple example:</p> <pre><code>public class MyCustomView extends FrameLayout { public MyCustomView(Context context) { super(context); } public MyCustomView(Context context, AttributeSet attrs) { super(context, attrs); } public MyCustomView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } } </code></pre> <p>&nbsp;</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"&gt; &lt;com.myprojectxxx.view.MyCustomView android:layout_width="48dp" android:layout_height="48dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Android Studio always says,</p> <blockquote> <p>Rendering Problems</p> <p>The following classes could not be found:</p> <ul> <li>com.myprojectxxx.view.MyCustomView (Fix Build Path, Create Class)</li> </ul> <p>Tip: Try to build the project</p> </blockquote> <p>Of course, I HAVE that class. If I click "Create Class", it complains that the same class already exists. If I rebuild that project, nothing changes.</p> <p>And, yes, the project works very well on my Android device. Also, it is rendered very well in Eclipse ADT. However, in Android Studio, it always says that "CLASSES COULD NOT BE FOUND."</p> <p>Android Studio does not have the ability to preview a xml file with custom views? What's wrong with this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload