en double possible de Linear Layout and weight in AndroidAndroid, troubles de la vue personnalisée classe poids de mise en page linéaire
Salut,
Je question étrange. J'ai conçu un widget personnalisé qui a une disposition linéaire avec trois boutons. Il est le code est comme ceci:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3" >
<ToggleButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/tbBrowse"
android:background="@drawable/btn_tg_browse"
android:textOn=""
android:textOff=""
android:focusable="false"
android:focusableInTouchMode="false"
android:checked="false"
android:gravity="bottom"/>
<ToggleButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/tbHotSpot"
android:background="@drawable/btn_tg_hotspot"
android:textOn=""
android:textOff=""
android:focusable="false"
android:focusableInTouchMode="false"
android:checked="true"
android:gravity="bottom"/>
<ToggleButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/tbMatches"
android:background="@drawable/btn_tg_matches"
android:textOn=""
android:textOff=""
android:focusable="false"
android:focusableInTouchMode="false"
android:checked="false"
android:gravity="bottom"/>
</LinearLayout>
Il est look and feel est comme ce qui semble correct:
J'ai ajouté ce widget à ma classe (android: id = "@ + id/Pied de page "):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/White">
<view
android:layout_width="match_parent"
android:layout_height="wrap_content"
class="com.belldigital.widget.HeaderBar"
android:id="@+id/Header"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<view
android:layout_width="match_parent"
android:layout_height="wrap_content"
class="com.belldigital.widget.FooterBar"
android:id="@+id/Footer"
android:layout_alignParentBottom="true" />
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/Header"
android:layout_above="@id/Footer"/>
</RelativeLayout>
Depuis, pas de gravité est défini dans la déclaration « view » Je me attends à même apparence et se sentir comme première image, mais je vois l'image suivante dans les deux émulateur et le dispositif réel.
Qu'est-ce que vous pensez? Cela pourrait être correct si je remodèle mon widget en fonction de la disposition relative. Cependant, je pense que la conception actuelle est correcte, mais pourquoi «voir» le trouble du widget mon arrangement? Tout commentaire/suggestion serait apprécié.