我在我的應用程序中有一個TabHost,並試圖將圖像instad文本。 我的問題是,圖像拉伸到整個屏幕,而不是其實際大小。即時通訊使用「wrap_content」在高度和寬度,它仍然在做。當我把相同的圖像與「wrap_content」一些其他的東西,它確定。只有在選項卡中它很奇怪。這就是它的樣子:在標籤中拉伸的圖像android
,而不是尋找這樣的:
這就是我的代碼:
<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center_vertical"
android:showDividers="none" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="start" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="stop" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="first tab" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="second tab B" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Secont tab" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
謝謝!