0
你好,为什么我的活动中的这个酒吧是隐藏的? 这是我的截图Android:如何显示此栏并在工具栏中添加图标?
如何显示呢?并添加图标和标题在工具栏中
这是我的活动users.xml中
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/scrollView"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar"
android:id="@+id/tb">
</include>
<android.support.v7.widget.CardView
android:id="@+id/cardview1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@android:color/white"
card_view:cardCornerRadius="8dp"
card_view:cardElevation="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:background="@color/lignt_blue"
android:paddingLeft="25dp">
....
这是我的活动users.java
public class Users extends AppCompatActivity {
private TextView editName;
private ImageView imageView1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.users);
Intent intent = getIntent();
String ref2 = intent.getStringExtra("ref");
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
editName = (TextView) findViewById(R.id.editName);
imageView1= (ImageView)findViewById(R.id.imageView1);
}
这是我toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" />
您的状态栏未被隐藏。它采用在color.xml或styles.xml中定义的Primarycolor的颜色。 –
没有我的颜色是蓝色#3F51B5 with –
你可以张贴您的整个样式xml。这可能对我有帮助 –