Tabhost 위에 맞춤 막대를 설정하려고합니다. 그러나 그것은 오지 않을 것입니다. 나는 "requestWindowFeature (Window.FEATURE_CUSTOM_TITLE);"을 사용하고 싶지 않습니다. " 나는 모든 스크린에서 같은 코드를 사용하기를 원한다. 그리고 다른 모든 화면에서는 탭 호스트가있는이 화면을 제외하고는 완벽합니다. 어떤 이유 ? 제목 표시 줄에 대한사용자 정의 제목 표시 줄이 안드로이드의 TabHost 위에 오지 않습니다
코드 :
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/windowtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#0a2436"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="10dip"
android:paddingTop="10dip"
android:src="@drawable/logo">
</ImageView>
<ImageButton
android:id="@+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="3dip"
android:background="@android:color/transparent"
android:src="@drawable/sync"
android:gravity="center"
android:text="Sync" />
</RelativeLayout>
전체 코드 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/formLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/windowtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#0a2436"
android:gravity="center_horizontal|center_vertical"
android:paddingBottom="10dip"
android:paddingTop="10dip"
android:src="@drawable/logo">
</ImageView>
<ImageButton
android:id="@+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="3dip"
android:background="@android:color/transparent"
android:src="@drawable/sync"
android:gravity="center"
android:text="Sync" />
</RelativeLayout>
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<View
android:id="@+id/separator"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_below="@android:id/tabs" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/btnSend"
android:layout_below="@+id/separator"
android:paddingBottom="45dip" >
<!-- Scrollview for message data -->
<ScrollView
android:id="@+id/formTab"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
<LinearLayout
android:id="@+id/formLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="5dip" />
</LinearLayout>
</ScrollView>
</FrameLayout>
</RelativeLayout>
</TabHost>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<Button
android:id="@+id/home"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Activity"
android:textColor="#ffffff" />
<Button
android:id="@+id/status"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Support"
android:textColor="#ffffff" />
<Button
android:id="@+id/support"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="15dip"
android:text="Messages"
android:textColor="#ffffff" />
</TableRow>
</TableLayout>
</RelativeLayout>
감사
감사합니다. "@ 이름을 표시 할 수 없습니다";) 작동했습니다. – user45678
환영합니다 :) @ user45678 –
작동하는 경우 ... 허용 ... 다른 사용자에게 유용 할 수 있습니다.) –