您好,我正在学习使用本教程来创建材质设计。 https://www.youtube.com/watch?v=pMO8EVkhJO8&list=PLonJJ3BVjZW6CtAMbJz1XD8ELUs1KXaTD&index=3Android材质设计错误
在我的设计中,appbar在所有面上都有填充。有人可以帮我删除这个填充,使应用看起来像一个真正的应用栏。
app_bar
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="#DDDD">
</android.support.v7.widget.Toolbar>
主要活动
<RelativeLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<include android:id="@+id/app_bar" layout="@layout/app_bar"/>
<TextView
android:layout_below="@+id/app_bar"
android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
maniAct ivity.java
private Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
}
很好的解决方案..!对我的作品。 – Vasu