Correction des dimensions des toolbar pour faire apparaître le bouton back

This commit is contained in:
Jacques Foucry 2016-05-22 18:30:58 +02:00
parent 003f577288
commit bbbae5639d
5 changed files with 13 additions and 7 deletions

View file

@ -23,7 +23,11 @@ public class MedicamentDetailActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_medicament_detail); setContentView(R.layout.activity_medicament_detail);
Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
setSupportActionBar(toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(getTitle());
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CollapsingToolbarLayout;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View file

@ -64,8 +64,11 @@ public class MedicamentListActivity extends AppCompatActivity {
dbHelper = new DBHelper(this); dbHelper = new DBHelper(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(getTitle()); if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setTitle(getTitle());
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {

View file

@ -17,10 +17,8 @@
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout" android:id="@+id/toolbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="100dp" android:layout_height="25dp"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:title="Prout"
android:titleTextColor="@android:color/black"
app:contentScrim="?attr/colorPrimary" app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed" app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar"/> app:toolbarId="@+id/toolbar"/>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
<dimen name="app_bar_height">100dp</dimen> <dimen name="app_bar_height">75dp</dimen>
<dimen name="item_width">200dp</dimen> <dimen name="item_width">200dp</dimen>
<dimen name="text_margin">16dp</dimen> <dimen name="text_margin">16dp</dimen>
</resources> </resources>