How do i make a fit tablayout in every screen?
up vote
0
down vote
favorite
I have made a design for TabLayout
, but I can't make the size fit with 2 different screens. I use two different screens like tablet and android phone.
How can I fix it?
This is my XML file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.inducesmile.androidmusicplayer
.fragment.LibraryFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorMaroon">
<ImageView
android:layout_width="match_parent"
android:layout_height="102dp"
android:src="@drawable/logo1"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabTextColor="@color/colorWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorMaroon"
app:tabMode="fixed"
app:tabIndicatorColor="@color/colorGold"
app:tabTextAppearance="@style/custTab"
app:tabSelectedTextColor="@color/colorGold"
android:layout_gravity="top"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
I want to make 4 menu/fragments with TabLayout
for the details, my XML was worked but the problem is the size not optimize if I run in tablet screen.
android android-studio android-layout
add a comment |
up vote
0
down vote
favorite
I have made a design for TabLayout
, but I can't make the size fit with 2 different screens. I use two different screens like tablet and android phone.
How can I fix it?
This is my XML file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.inducesmile.androidmusicplayer
.fragment.LibraryFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorMaroon">
<ImageView
android:layout_width="match_parent"
android:layout_height="102dp"
android:src="@drawable/logo1"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabTextColor="@color/colorWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorMaroon"
app:tabMode="fixed"
app:tabIndicatorColor="@color/colorGold"
app:tabTextAppearance="@style/custTab"
app:tabSelectedTextColor="@color/colorGold"
android:layout_gravity="top"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
I want to make 4 menu/fragments with TabLayout
for the details, my XML was worked but the problem is the size not optimize if I run in tablet screen.
android android-studio android-layout
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have made a design for TabLayout
, but I can't make the size fit with 2 different screens. I use two different screens like tablet and android phone.
How can I fix it?
This is my XML file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.inducesmile.androidmusicplayer
.fragment.LibraryFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorMaroon">
<ImageView
android:layout_width="match_parent"
android:layout_height="102dp"
android:src="@drawable/logo1"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabTextColor="@color/colorWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorMaroon"
app:tabMode="fixed"
app:tabIndicatorColor="@color/colorGold"
app:tabTextAppearance="@style/custTab"
app:tabSelectedTextColor="@color/colorGold"
android:layout_gravity="top"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
I want to make 4 menu/fragments with TabLayout
for the details, my XML was worked but the problem is the size not optimize if I run in tablet screen.
android android-studio android-layout
I have made a design for TabLayout
, but I can't make the size fit with 2 different screens. I use two different screens like tablet and android phone.
How can I fix it?
This is my XML file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.inducesmile.androidmusicplayer
.fragment.LibraryFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorMaroon">
<ImageView
android:layout_width="match_parent"
android:layout_height="102dp"
android:src="@drawable/logo1"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabTextColor="@color/colorWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorMaroon"
app:tabMode="fixed"
app:tabIndicatorColor="@color/colorGold"
app:tabTextAppearance="@style/custTab"
app:tabSelectedTextColor="@color/colorGold"
android:layout_gravity="top"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
I want to make 4 menu/fragments with TabLayout
for the details, my XML was worked but the problem is the size not optimize if I run in tablet screen.
android android-studio android-layout
android android-studio android-layout
edited Nov 19 at 4:41
André Sousa
1,092818
1,092818
asked Nov 18 at 19:33
Tri Ako Nugroho
134
134
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364702%2fhow-do-i-make-a-fit-tablayout-in-every-screen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown