2017-03-27 25 views
0

目前我正在使用Android用戶界面。是否可以使用任何方法或屬性製作可覆蓋Tablayout的較大標籤項目。在Android中覆蓋TabLayout的較大項目

喜歡這款相機按鈕:

enter image description here

在此先感謝。

+0

您可以自定義在TabLayout每個選項卡,並手動將其添加到您的TabLayout。 你閱讀這篇文章是爲了更清楚的解釋。 http://www.android4devs.com/2015/12/tab-layout-material-design-support.html –

+0

@RoShanShan我已經使用自己的自定義tablayout,但不知道標籤項目如何可以覆蓋Tablayout的邊框,如上圖所示。 :( –

+0

檢查下面的視圖 –

回答

0

你可以嘗試定製視圖這樣,你可以將相關的大小更改爲您的應用程序

enter image description here

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:orientation="vertical"> 

    <View android:layout_width="match_parent" 
     android:layout_height="1px" 
     android:layout_alignParentBottom="true" 
     android:layout_marginBottom="25dp" 
     android:background="@color/colorAccent"/> 

    <View android:layout_width="match_parent" 
     android:layout_height="1px" 
     android:layout_alignParentBottom="true" 
     android:background="@color/colorAccent"/> 

    <ImageView 
     android:id="@+id/imageView" 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_centerInParent="true" 
     android:src="@drawable/ic_menu_camera" 
     android:layout_gravity="center_horizontal" 
     android:background="@android:color/white"/> 

</RelativeLayout> 
+0

所以你的意思是把另一種佈局放在TabLayout之上?我試過了,但這是否是最佳做法?我認爲有任何方法可以自定義標籤項的位置 –

+0

否這是自定義佈局我想如果你想要更復雜的UI,你可以使用你的UI,不需要使用TabLayout。 –