在Android Studio 3.3中,当
TextView
被包含在LinearLayout
中时,左右两侧会出现奇怪的阴影。这个阴影在设备上安装后不会出现,只会在编辑器中出现。这是一个Bug还是Android Studio中的新功能?如果是一个功能,有没有办法禁用它?
test.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Shadow Appear"/>
</LinearLayout>
</RelativeLayout>
LinearLayout
将会移除那个阴影。同时也会显示一个警告:`这个 LinearLayout 布局或者它的 RelativeLayout 父布局是无用的。检查信息:一个有子元素但没有兄弟元素、不是 ScrollView 或根布局,并且没有背景的布局可以被移除,其子元素可以直接移动到父布局中,以获得更加扁平和高效的布局层次结构。` - kvarunatextview
的宽度可能是一个改进。 - kvaruna