Fondamentalement, ce que j'essaie de faire est d'avoir la moitié de l'écran soit une disposition de tabulation et une demi-image (ou vraiment toute autre chose). Cela fonctionne très bien jusqu'à ce que je commence à ajouter du poids.Fragment pondéré Android ne montrant pas
En l'état, rien n'est affiché. Qu'est-ce qui causerait ce problème?
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="left"
android:weightSum="2"
android:background="#00025a">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1">
<TabWidget
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs">
</TabWidget>
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:id="@android:id/tabcontent">
</FrameLayout>
<FrameLayout
android:id="@+id/tabcontent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
</LinearLayout>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/test_room_1"/>
</android.support.v4.app.FragmentTabHost>
Sans le poids du composant l'onglet affiche des trucs liés, mais je suppose qu'il pousse l'image comme il ne figure pas.
Toute aide serait appréciée. :)
MISE À JOUR:
Voici une capture d'écran comme demandé: Weighted
Et l'activité d'appel:
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
import android.widget.ImageView;
public class sandbox_mode extends FragmentActivity {
ImageView level_background;
private FragmentTabHost mTabHost;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sandbox_mode_play);
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);
mTabHost.addTab(mTabHost.newTabSpec("Enemy Tab").setIndicator("Enemies"),
enemy_tab.class, null);
}
}
Pouvez-vous ajouter une capture d'écran? – AndiGeeky
comment vous appelez ce fragment. veuillez ajouter ce code. –