0
我正在開發一個android應用程序,我想讓工具欄的標題爲白色。如何更改Android中工具欄標題的顏色?
我已刪除默認的工具欄和補充工具欄到我的活動,但無法弄清楚如何將工具欄的標題的顏色更改爲白色
MainActivity.java
package com.example.acer.videoapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(getResources().getString(R.string.app_name));
//toolbar.setTitleTextColor(white);
listView = (ListView) findViewById(R.id.listView);
ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_expandable_list_item_1,getResources().getStringArray(R.array.subjects));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int i, long id) {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
intent.putExtra("Subject", listView.getItemAtPosition(i).toString());
startActivity(intent);
}
});
listView.setAdapter(mAdapter);
}
}
toolbar.setTitleTextColor(白色)是不工作的
Toolbar
文本的顏色? – sasikumar沒有工作,我不知道爲什麼 – Dilinieee