Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio -Unable to inflate view tag without class attribute

When I enter a view tag into my xml code I get a Rendering Problem that says: "Unable to inflate view tag without class attribute". How can I fix this ?

    <view
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray">
    </view>

When I remove this code it renders fine.

like image 581
Dean Clancy Avatar asked Oct 14 '16 15:10

Dean Clancy


People also ask

Which function should you use to inflate the view of a fragment?

onCreateView() is called by Android once the Fragment should inflate a view. onViewCreated() is called after onCreateView() and ensures that the fragment's root view is non-null .

Is view a class in Android?

view has a child class called View. Observe While the View group is the container that houses all of these views as well as many other ViewGroup such as linear or Frame Layout.

What is inflating view in Android?

The general gist is this: If attachToRoot is set to true , then the layout file specified in the first parameter is inflated and attached to the ViewGroup specified in the second parameter. Then the method returns this combined View, with the ViewGroup as the root.


1 Answers

As mentioned in comment by Blackbelt, update view to View:

<View
    android:layout_width="1dp"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray">
</View>
like image 140
USKMobility Avatar answered Oct 06 '22 19:10

USKMobility