1

The Layout Editor's palette doesn't seem to have a blank view that I can drag in (unless my eyes are crazy).

Is there a way to drag a blank view from the palette in the Android Layout Editor onto the view I'm making (without having to type in the raw XML)?

Here's what I see under the "Common" section: Common Palette

Here's what I see when I search for "view": Palette search for view

Am I missing something?

I see a "< view >" under the "Containers" section, but that just pulls up a pop up with the same stuff that's already in the palette.

I'm new to Android dev and am coming from iOS where I can just drag a UIView right onto the storyboard. What's the equivalent of this behavior in Android?

Is there some way for me to add my own custom stuff to the Layout Editor palette?

Is typing <View ... /> in the raw XML the only way of achieving this?

Xavier L.
  • 709
  • 5
  • 21

3 Answers3

1

My eyes are crazy.

Press "Widgets" (circled in red)

Drag in "View" (circled in green)

found it

Anyone able to explain why it's under "Widgets"?

Xavier L.
  • 709
  • 5
  • 21
0

You can use android:alpha="0.5" to set 50% opacity.

To use simple View, as an overlay for example, you can use the code below inside XML.

<View
        android:id="@+id/overlayOrSomethingElse"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        android:alpha="0.5"
        android:background="@android:color/black" />
0

There is a View on the palette and you can do something like this.

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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=".Main2Activity">

    <View
        android:id="@+id/view"
        android:layout_width="wrap_content"
        android:layout_height="243dp"
        android:background="#0000ff"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="349dp" />

    <View
        android:id="@+id/view3"
        android:layout_width="wrap_content"
        android:layout_height="4dp"
        android:background="#ffffff"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="469dp" />

</android.support.constraint.ConstraintLayout>
mrvinent
  • 115
  • 2
  • 16