Xin chào, tôi đã tạo một hoạt động mở rộng ActionBarActivity
& sử dụng chủ đề material trong ứng dụng của tôi. Trong thanh hành động, nút quay lại không hiển thị.Nút Quay lại thanh tác vụ không hiển thị trong Android
Tôi không tìm thấy lý do tại sao nó không hiển thị. Bất kỳ giúp đỡ?
public class RegistrationActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_background_light));
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!--Support Library compatibility-->
<item name="actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>
<!-- ActionBar styles -->
<style name="MyTheme.ActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
<!--Support Library compatibility-->
<item name="titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
</style>
AndroidManifest.xml
<activity
android:name=".RegistrationActivity"
android:label="@string/title_activity_registration" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".HomeScreenActivity" />
</activity>
Cảm ơn trước.
Sử dụng 'Theme.AppCompat.Light.DarkActionBar' nếu bạn muốn biểu tượng/văn bản xuất hiện màu trắng trong thanh tác vụ. – ianhanniballake
@ianhanniballake yes đã cảm ơn :) –