I'm facing strange warning, trying to customize the Toolbar appearance. I put RelativeLayout
inside android.support.v7.widget.Toolbar
to reorganize Toolbar
. Everything works and appears as expected on both emulator and device. The only problem is the annoying warning that appears in .xml file as seen below:
The question is what is the actual problem, how can it harm my application and how can I solve this warning. As I know Toolbar
behaves as ViewGroup
, why RelativeLayout
is not allowed to be it's child?
Thanks.
Toolbar
extends from ViewGroup
and RelativeLayout's
too.
I've tried that on Android Studio 1.5.1
and i couldn't see that problem.
<android.support.v7.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<RelativeLayout
android:id="@+id/toolBarTv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="18dp">
</RelativeLayout>
</android.support.v7.widget.Toolbar>
You should be able to update your Android Studio
to the last version or checking if you are using outdated Platform
, then you need to just update that Platform
to the last version.
And then it won't show up.or perhaps it will fixed in the next update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With