0
私はtablayoutを実装しましたが、エミュレータで正しく動作していません。デバイスの高さが正しく表示されていません。誰が問題が何であるか教えていただけますか?アンドロイドデバイスでタブの高さが正しく表示されない
これは私のレイアウトファイル
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/black"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@android:id/tabs" />
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
</TabHost>
</LinearLayout>
この私のJavaコードが設定された高さと幅のある
for (int i =0; i<tabWidget.getChildCount(); i++) {
//tabWidget.getChildAt(i).setBackgroundColor(R.color.black);
tabWidget.getChildAt(i).getLayoutParams().height = height;
tabWidget.getChildAt(i).getLayoutParams().width = width;
RelativeLayout relLayout = (RelativeLayout)tabWidget.getChildAt(i);
TextView tv = (TextView)relLayout.getChildAt(1);
tv.setTextSize(10.0f);
tv.setTypeface(myTypeface1);
}
は、誰もがどのようにタブバーの高さと幅を設定する方法を教えてもらえますか?サンプルコードにこれはおそらく、エミュレータとデバイス間で画面密度の差に関係している
おかげ
をなぜあなたはコードから幅を設定していますか? – Janusz