Problème positionnement Action bar.
Bonjour je débute en développement android, et j'ai quelques problèmes. J'ai crée une action bar et j'ai du mal a lui faire prendre toute la largeur de l'écran.
Voici le layout de l'action bar:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:background="#333242"
android:layout_height="wrap_content" android:orientation="horizontal"
android:baselineAligned="true">
<ImageView android:id="@+id/imageView1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/ab"></ImageView>
<ImageButton android:src="@android:drawable/ic_menu_rotate"
android:layout_gravity="center_vertical" android:id="@+id/reload"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:background="@android:color/transparent"></ImageButton>
</LinearLayout> |
Le code de l'action bar :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
package com.rss.test;
import com.rss.test.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
public class ActionBar extends LinearLayout {
LayoutInflater inflater;
View view;
public ActionBar(Context context, AttributeSet attrs) {
super(context, attrs);
this.inflater = LayoutInflater.from(context);
this.view = this.inflater.inflate(R.layout.action_bar, null);
this.addView(this.view);
}
} |
Et le layout de mon activité :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.rss.test.ActionBar android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/action_bar_main"/>
<ListView android:layout_height="wrap_content" android:id="@+id/news"
android:layout_width="fill_parent" android:background="#FFFFFF"></ListView>
</LinearLayout> |
Je ne vois pas du tout d'ou vient le problème j'ai pourtant bien mis du "fill_parent" sur tous les layout_width.
Si vous pouvez m'aider ce serait sympa car ça fait des heures que je bloque.