我在ToolBar中放入了LinearLayout1,然後在LinearLayout1中放入了另外5個LinearLayout。每個孩子LinearLayout都有一個ImageView。這裏我的問題是LinearLayout1不匹配父寬度。我在圖像中顯示(紅色圓圈)。黑色是我給ToolBar的背景。ToolBar中的LinearLayout與父項不匹配
<android.support.v7.widget.Toolbar
android:id="@+id/featured_bottomToolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:background="#000000"
android:layout_alignParentBottom="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/menu_black_featured"
android:id="@+id/imageView" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/menu_grey_justin2"
android:id="@+id/imageView2" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/menu_grey_designers"
android:id="@+id/imageView3" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/menu_grey_categories"
android:id="@+id/imageView4" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/meny_grey_more2"
android:id="@+id/imageView5" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
我得到的輸出。
後的代碼,以便我們可以幫助你。 –
您是否使用工具欄手動創建tabhost? –
我已發佈。請通過它並幫助。 –