基本的には、画面の半分をタブレイアウトにし、イメージの半分(または実際には他のもの)を使用します。それは私が体重を加え始めるまでうまく動作します。Androidの重み付けされたフラグメントが表示されない
そのまま、何も表示されません。この問題の原因は何ですか?量成分タブ関連のものを表示しなければ
<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>
が、私はそれが示されていないとして、それはイメージを押し出すと仮定しています。
ご協力いただければ幸いです。 :)
UPDATE:要求されたとして
ここではスクリーンショットです:Weighted
、呼び出しアクティビティ:
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);
}
}
スクリーンショットを追加できますか? – AndiGeeky
このフラグメントをどのように呼び出していますか。そのコードを追加してください。 –