Ich habe ein Layout, wie folgend -Tabs mit benutzerdefinierter Ansicht wird das Aufblasen nicht in TabLayout am unteren Rande des Bildschirms
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:weightSum="6"
android:id="@+id/main_global_container"
>
<!--<include-->
<!--android:id="@+id/mainAppBar"-->
<!--layout="@layout/view_appbar" />-->
<!--<ProgressBar-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--style="@android:style/Widget.Holo.Light.ProgressBar.Large"-->
<!--android:layout_margin="35dp"-->
<!--android:id="@+id/homescreenProgressbar"-->
<!--android:gravity="center_horizontal"-->
<!--android:visibility="invisible"-->
<!--/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:weightSum="3"
android:layout_weight="2.5"
android:background="@color/black"
android:id="@+id/upper_container">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
android:weightSum="2"
android:background="@color/formInactiveFont"
android:id="@+id/upper_left_container"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="Welcome,"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="21dp"
android:id="@+id/textView5"
/>
<TextView
android:text="Devansh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="22dp"
android:layout_marginStart="22dp"
android:layout_marginTop="42dp"
android:id="@+id/textView6"
/>
<TextView
android:text="Custome message will appear here"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="73dp"
android:id="@+id/textView7"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:srcCompat="@drawable/hexagone"
android:id="@+id/imageView"
android:layout_marginRight="12dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="12dp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/black"
android:layout_centerHorizontal="true"
android:id="@+id/view4"
android:layout_marginTop="7dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:id="@+id/textView8"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/hexagone"/>
<TextView
android:text="Total Score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="23dp"
android:layout_marginStart="23dp"
android:layout_marginTop="13dp"
android:id="@+id/textView11"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="Begainner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView12"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/textView11"
android:layout_alignStart="@+id/textView11" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.3"
android:background="@color/accentColor"
android:id="@+id/upper_right_container"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Keep Learning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView13"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:srcCompat="@drawable/logo"
android:id="@+id/imageView2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:text="Take Quiz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/textView13"
android:layout_alignEnd="@+id/textView13"
style="@style/quizBtnHome"
android:id="@+id/button4" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="3.5"
android:id="@+id/bottom_container">
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/home_view_pager">
</android.support.v4.view.ViewPager>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="100dp"
app:tabGravity="fill"
app:tabMode="fixed"
/>
</LinearLayout>
i Tabs in tablayout am Aufpumpen xml-Layout mit folgenden -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/star_big_on"
android:id="@+id/imageView3"
/>
<TextView
android:text="Topic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView10"
android:layout_margin="7dp" />
</LinearLayout>
Dann richte ich Viewpager mit meinem Tablayout ein.
Das Problem ist, dass ich ein leeres Tab-Layout mit leeren Tabs bekomme, sie zeigen nicht ihr Layout, aber wenn ich View Pager ausschließe, dann werden sie richtig aufgeblasen und zeigen, was sie zeigen sollen.
Bitte helfen. Danke im Voraus.
Zeigen Sie Ihre Layout-Code –
@BurhanuddinRashid –