Bonjour à tous,

Je poste ici car le soucis, graphique, concerne à priori la version 4.4 d'Android et seulement celle-ci.
En effet sur Galaxy S3, Nexus 4, galaxy Ace et Wiko cink+, l'ActionBar custom est bien affichée alors que sur mon Nexus 5 en v4.4 l'ActionBar ne colle pas au bord gauche de l'écran...

le code trés simplement:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
private void initActionBar() {
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
 
        mActionBarCustom = (ActionBarCustom) getLayoutInflater().inflate(R.layout.widget_actionbar,
                null);
        mActionBarCustom.init();
        mActionBarCustom.setBtnMenuOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
                    mDrawerLayout.closeDrawer(mDrawerList);
                } else {
                    mDrawerLayout.openDrawer(mDrawerList);
                }
            }
        });
        mActionBarCustom.setBtnLoginOnClickListener(new OnClickListener() {
            [...]
        });
        actionBar.setCustomView(mActionBarCustom);
    }
et le xml qui va avec:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
<?xml version="1.0" encoding="utf-8"?>
<com.widget.ActionBarCustom xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:appli="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="#3BA5B7"
    android:orientation="horizontal"
    >
 
    <ImageButton
        android:id="@+id/actionbar_btn_menu"
        android:layout_width="46dp"
        android:layout_height="46dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="2dp"
        android:background="@color/background_blue"
        android:contentDescription="@string/cd_actionbar_btn_menu"
        android:scaleType="center"
        android:src="@drawable/icon_menu" />
 
    <com.widget.roboto.TextView
        android:id="@+id/actionbar_title"
        android:layout_width="wrap_content"
        android:layout_height="46dp"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="1dp"
        android:layout_marginRight="1dp"
        android:layout_toLeftOf="@+id/actionbar_btn_login"
        android:layout_toRightOf="@+id/actionbar_btn_menu"
        android:background="@color/background_blue"
        android:gravity="center"
        android:textColor="@android:color/white"
        android:textSize="18sp"
        bpeek:robotoType="@id/roboto_bold" />
 
    <ImageButton
        android:id="@+id/actionbar_btn_login"
        android:layout_width="46dp"
        android:layout_height="46dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="2dp"
        android:background="@color/background_blue"
        android:gravity="center"
        android:src="@drawable/btn_off" />
 
</com.widget.ActionBarCustom>

Pour des versions antérieures à la 4.4 :

Uploaded with ImageShack.com

Et sur Nexus 5 (et donc en v4.4) :

Uploaded with ImageShack.com


Quelqu'un saurait comment corriger ce "décallage" de l'ActionBar sur Android 4.4?

D'avance merci
Gob.