我用tablayout製作了一個viewpager,我用自定義視圖來顯示服務器上的圖標,一切正常,但標籤圖標沒有完全顯示.i上傳了一張圖片。如何解決這個問題。我試圖與圖像高度寬度匹配父母或靜態大小像50dp等,但沒有任何工作。如何使tablayout圖標變大/適合每個標籤空間?
我tablayout:爲圖標
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/smileyShowViewPagerId"
android:background="#ececec"
>
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tabLayoutId"
android:background="#99a4b1"
app:tabTextColor="#000000"
app:tabMode="fixed"
app:tabIndicatorColor="#6259b3"
>
</android.support.design.widget.TabLayout>
</android.support.v4.view.ViewPager>
自定義佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageId_tabIcon"
android:layout_gravity="center"
/>
</LinearLayout>
請誰能幫助我在這個問題上我已經搜索的Android教程網站和搜索對谷歌太多,但沒有辦法解決那裏。
後您的自定義佈局。將tablayout重力設置爲'fill' – Piyush
它被設置爲填充重力。但沒有工作。 和我編輯上面的代碼 – AAA