Search code examples
androidandroid-toolbar

Shadows on toolbar and menu not showing in duplicate layout


I encountered a weird situation that one of the activity layout (design) acts differently!!To check the error I Just copied another activity with working design and link that activity!! But to my surprise, the copied activity layout design changed, which is working before! I am attaching the images for reference!!

  1. Activity that Works fine here
  2. The activity copied and created another activity and linked

Code of the activity:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fabric.with(this, new Crashlytics());
        setContentView(R.layout.activity_topup_method);
        toolbar = (Toolbar) findViewById(R.id.tool_bar);
        setSupportActionBar(toolbar);
        prefs = new PreferenceHelper(TopupOperators.this);
        topup = (LinearLayout)findViewById(R.id.topup);
        eload  = (LinearLayout) findViewById(R.id.eload);
        check = new CheckInterNetConnection(TopupOperators.this);
        isInternetPresent = check.isConnectingToInternet();
        topup.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Intent intent = new Intent(TopupOperators.this, TopupAll.class);
                intent.putExtra("mode", "topup");
                startActivity(intent);
            }
        });
        eload.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Intent intent = new Intent(TopupOperators.this, TopupAll.class);
                intent.putExtra("mode", "eload");
                startActivity(intent);
            }
        });
    }

----Both the activity has same code---

Layout file:

<RelativeLayout 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:background="#fff">
    <include
        android:id="@+id/tool_bar"
        layout="@layout/tool_bar"
        ></include>
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progressBar"
        android:layout_centerInParent="true"
        android:visibility="gone"/>

    <ImageView
        android:id="@+id/zigzag_bottom"
        android:layout_width="match_parent"
        android:layout_below="@+id/mylayout"
        android:layout_height="18dp"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:src="@drawable/zigzag"/>

    <RelativeLayout
        android:id="@+id/mylayout"
        android:background="@color/colorPrimary"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_below="@+id/tool_bar"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

        <TextView
            android:text="SELECT RECHARGE METHOD"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="22dp"
            android:id="@+id/textView"
            android:textSize="18sp"
            android:textColor="#fff"
            android:textStyle="normal|bold" />
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/eload"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="33dp"
        android:background="@drawable/gridbackground"
        android:orientation="vertical"
        android:src="@drawable/voucher"
        android:padding="5dp"
        android:layout_below="@+id/topup"
        android:layout_centerHorizontal="true">


        <de.hdodenhof.circleimageview.CircleImageView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/grid_item_image2"
            android:layout_width="95dp"
            android:src="@drawable/eload"
            android:layout_height="95dp"/>
        <TextView
            android:id="@+id/grid_item_title2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:gravity="center"
            android:text="E-load"
            android:maxLines="2"
            android:ellipsize="marquee"
            android:textSize="15sp"
            android:textStyle="normal|bold" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/topup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/gridbackground"
        android:orientation="vertical"
        android:padding="5dp"
        android:layout_below="@+id/zigzag_bottom"
        android:layout_alignLeft="@+id/eload"
        android:layout_alignStart="@+id/eload">


        <de.hdodenhof.circleimageview.CircleImageView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/grid_item_image1"
            android:layout_width="95dp"
            android:layout_height="95dp"
            android:src="@drawable/voucher"/>
        <TextView
            android:id="@+id/grid_item_title1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:gravity="center"
            android:maxLines="2"
            android:ellipsize="marquee"
            android:textSize="15sp"
            android:textStyle="normal|bold"
            android:text="Voucher" />

    </LinearLayout>

Please help:

MANIFEST:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mobeeloadpartner">

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme">
        <activity
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:name=".Splashscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".DeviceVerification"
            android:screenOrientation="portrait"
            android:label="@string/deviceVerification" >
        </activity>
        <activity
            android:name=".TopupList"
            android:screenOrientation="portrait"
            android:label="Mobile Topup" >
        </activity>
        <activity
            android:name=".Pinverification"
            android:screenOrientation="portrait"
            android:label="@string/pinVerification" >
        </activity>
        <activity
            android:name=".CouponRedeem"
            android:screenOrientation="portrait"
            android:label="Coupon Redeem" >
        </activity>

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".Topup"
            android:hardwareAccelerated="false"
            android:screenOrientation="portrait"
            android:label="@string/topupTab" >
        </activity>
        <activity
            android:name=".TopupAll"
            android:hardwareAccelerated="false"
            android:screenOrientation="portrait"
            android:label="@string/topupTab" >
        </activity>
        <activity
            android:name=".TopupOperators"
            android:hardwareAccelerated="false"
            android:screenOrientation="portrait"
            android:label="@string/topupTab" >
        </activity>
        <activity
            android:name=".RechargeActivity"
            android:screenOrientation="portrait"
            android:label="@string/rechargeTab" >
        </activity>
        <activity
            android:name=".EloadActivity1"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait"
            android:label="@string/erechargeTab" >
        </activity>

        <activity
            android:name=".BankReport"
            android:windowSoftInputMode="adjustPan"
            android:label="Status" >
        </activity>
        <activity
            android:name=".SettingsActivity"
            android:screenOrientation="portrait"
            android:label="@string/settings" >
        </activity>
        <activity
            android:name=".Earnings"
            android:screenOrientation="portrait"
            android:label="@string/earnings_redem" >
        </activity>
        <activity
            android:name=".BankInCash"
            android:screenOrientation="portrait"
            android:label="@string/bank_deposit" >
        </activity>
        <activity
            android:name=".TransactionsActivity"
            android:screenOrientation="portrait"
            android:label="@string/transactions" >
        </activity>
        <activity
            android:name=".BankActivity"
            android:screenOrientation="portrait"
            android:label="@string/bankactivity" >
        </activity>
        <activity
            android:name=".PrintActivity"
            android:screenOrientation="portrait"
            android:label="Print POS" >
        </activity>
        <activity
            android:name=".PrintBluetooth"
            android:screenOrientation="portrait"
            android:label="Print Bluetooth" >
        </activity>
        <activity
            android:name=".Transactionstatus"
            android:screenOrientation="portrait"
            android:label="Transaction Status" >
        </activity>
        <activity
            android:name=".InternationalCountry"
            android:screenOrientation="portrait"
            android:label="International Topup" >
        </activity>

        <activity
            android:name=".InternationalZone"
            android:screenOrientation="portrait"
            android:label="International Topup" >
        </activity>

        <activity
            android:name=".InternationalOperators"
            android:screenOrientation="portrait"
            android:label="International Topup" >
        </activity>
        <activity
            android:name=".DthList"
            android:screenOrientation="portrait"
            android:label="DTH" >
        </activity>
        <activity
            android:name=".DTHRecharge"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan"
            android:label="DTH Recharge" >
        </activity>
        <activity
            android:name=".InternationalTopup"
            android:windowSoftInputMode="adjustPan"
            android:screenOrientation="portrait"
            android:label="International Topup" >
        </activity>
        <activity
            android:name=".BillPaymentServices"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".BillPaymentType"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".BillPaymentOperators"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".BillPaymentRecharge"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>

        <activity
            android:name=".BillPaymentVVP"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".Login"
            android:screenOrientation="portrait"
            android:label="Login" >
        </activity>
        <activity
            android:name=".BillPaymentold"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>

        <activity
            android:name=".BillPaymentFVV"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>

        <activity
            android:name=".BillPaymentVVR"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".ComingSoon"
            android:screenOrientation="portrait"
            android:label="Coming Soon" >
        </activity>
        <activity
            android:name=".PaperRequest"
            android:screenOrientation="portrait"
            android:label="Paper Request" >
        </activity>
        <activity
            android:name=".BillpaymentCountry"
            android:screenOrientation="portrait"
            android:label="Bill Payment" >
        </activity>
        <activity
            android:name=".GlobalActivity"
            android:screenOrientation="portrait"
            android:label="International Payments" >
        </activity>
        <activity
            android:name=".VoucherActivity"
            android:screenOrientation="portrait"
            android:label="Voucher Printing" >
        </activity>
        <activity
            android:name=".FundTransferHistory"
            android:screenOrientation="portrait"
            android:label="Fund Transfer History" >
        </activity>
        <activity
            android:name=".TransactionStatusBT"
            android:screenOrientation="portrait"
            android:label="Transaction Status" >
        </activity>
        <activity
            android:name=".SalesReport"
            android:screenOrientation="portrait"
            android:label="Sales Report" >
        </activity>
        <activity
            android:name=".SalesReportPOS"
            android:screenOrientation="portrait"
            android:label="Sales Report" >
        </activity>

        <activity
            android:name=".TransactionStatusPOS"
            android:screenOrientation="portrait"
            android:label="Transaction Status" >
        </activity>

        <activity android:name=".DeviceListActivity"
            android:label="@string/select_device"
            android:theme="@android:style/Theme.Dialog"
            android:configChanges="orientation|keyboardHidden" />


        <service android:name=".MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name=".FirebaseIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="xxxxxxx"
            />
    </application>

</manifest>

Solution

  • Finally, able to get what the issue!

    android:hardwareAccelerated="false"
    

    This line in the manifest was making the issue. removing the line solved the issue!! In Android developer docs, it is saying that they may affect some views!