Android layout Android材质设计-立面阴影不适用于嵌套内部布局
我正在编写一个带有一些嵌套布局的代码。由于我使用了材料设计,我还想设置标高。尽管立面与最外层布局的元素配合得很好,但内部Android layout Android材质设计-立面阴影不适用于嵌套内部布局,android-layout,material-design,android-elevation,Android Layout,Material Design,Android Elevation,我正在编写一个带有一些嵌套布局的代码。由于我使用了材料设计,我还想设置标高。尽管立面与最外层布局的元素配合得很好,但内部线性布局(嵌套在坐标布局)的内容不会投射阴影,尽管设置了立面 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.an
线性布局
(嵌套在坐标布局
)的内容不会投射阴影,尽管设置了立面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/white"
tools:context="com.joblesscoders.aditya.todolist.HomeActivity">
<TextView
android:layout_width="match_parent"
android:id="@+id/count"
android:text="Main Activity"
android:textSize="20dp"
android:elevation="5dp"
android:textColor="@color/white"
android:gravity="center_vertical"
android:background="@color/colorPrimary"
android:layout_height="50dp" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cly"
android:background="@color/white"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/sv"
android:background="@color/white"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lly"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:text="Task here"
android:id="@+id/tid"
android:textSize="40sp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:elevation="4dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_height="wrap_content" />
<TextView
android:text="Task here"
android:id="@+id/tid"
android:textSize="40sp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:elevation="4dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_height="wrap_content" />
<TextView
android:text="Task here"
android:id="@+id/tid"
android:textSize="40sp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:elevation="4dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:layout_height="wrap_content" />
<!-- More TextViews to suit purpose -->
</LinearLayout>
</ScrollView>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_add2"
app:rippleColor="@color/white"
android:id="@+id/fab"
android:layout_gravity="bottom|end"
/>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
android studio designer视图中的此代码生成预期结果,即。
显示“Task here”的文本视图需要阴影,但当我在android 6.O自定义设备上运行它时,页面就会变成:
如果有人能纠正我的错误或建议我做什么和不做什么,我将不胜感激。我对android编程非常陌生,这是我的第一段代码。所以,如果我犯了任何非常愚蠢的错误,请原谅我