0

I have a complete Android project. I was made it by the GridLayout and CardView. Everything is well. I have tested this app with my all of the emulators, which are working fine, but while I'm trying to open my app with

Lava Iris505

and

Symphony Xplorer v60

it's not working perfectly. Please see this below image. Error

But while I've installed this app on my Xioami Redmi 4x or any other Android Studio emulator, it's showing all my works like this below image.

No Error

My activity code is:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBG"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".Home">

    <!-- TODO: Update blank fragment layout -->
    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:orientation="vertical"
            android:weightSum="10"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <GridLayout
                android:id="@+id/mainGrid"
                android:layout_width="match_parent"
                android:layout_height="736dp"
                android:layout_weight="8"
                android:alignmentMode="alignMargins"
                android:columnCount="2"
                android:columnOrderPreserved="false"
                android:padding="14dp"
                android:rowCount="3">

                <!-- Row 1 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/news24"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/news24" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/deshebideshe"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/deshebideshe" />


                    </LinearLayout>

                </android.support.v7.widget.CardView>


                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/jamuna"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/jamuna" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/satv"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/satv" />


                    </LinearLayout>

                </android.support.v7.widget.CardView>


                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/jagobanglatv"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/jagobanglatv" />


                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/nrbtv"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/nrbtv" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/rtvmusic"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/rtvmusic" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/qtv"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/qtv" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/panvisiontv"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/panvisiontv" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/millennium"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/millennium" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/btvworld"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/btvworld" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:id="@+id/probashibangla"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@drawable/probashibangla" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

            </GridLayout>

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

</FrameLayout>

and my gradle file is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.1'
    defaultConfig {
        applicationId "net.gurujibd.ajkerkhobor"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 6
        versionName "5.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.android.gms:play-services-ads:9.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
    implementation 'com.android.support:support-v4:28.0.0-beta01'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support:cardview-v7:28.0.0-beta01'
    implementation 'com.android.support:gridlayout-v7:28.0.0-beta01'
    implementation 'com.android.support:design:28.0.0-beta01'
    implementation 'com.devbrackets.android:exomedia:4.2.3'
    implementation 'com.android.support:gridlayout-v7:28.0.0-beta01'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
Michael Dodd
  • 10,102
  • 12
  • 51
  • 64
Noni Gopal
  • 49
  • 9

1 Answers1

0

Hello, welcome to Stack Overflow

I suggest you use RecycleView if you want to archive that design which you posted. also set GridView Layout manager to your RecyclerView For GridView Click here

And you are develop application which support different screen size(mobile and tablet) click on this link

design

Happy Learning!!!

Arbaz.in
  • 1,478
  • 2
  • 19
  • 41