工具栏和菜单上的阴影不显示在重复的布局中

时间:2017-08-21 06:44:54

标签: android android-toolbar

我遇到了一个奇怪的情况,其中一个活动布局(设计)的行为不同!!要检查错误,我只是复制了另一个带有工作设计的活动并链接该活动!!但令我惊讶的是,复制的活动布局设计发生了变化,这在以前是有效的!我附上图片供参考!!

  1. Activity that Works fine here
  2. The activity copied and created another activity and linked
  3. 活动代码:

    @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);
                }
            });
        }
    

    ----两个活动都有相同的代码---

    布局文件:

    <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>
    

    请帮助:

    清单:

    <?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>
    

1 个答案:

答案 0 :(得分:1)

最后,能够得到什么问题!

android:hardwareAccelerated="false"

清单中的这一行正在解决问题。删除线解决了问题!!在Android开发人员文档中,它表示它们可能会影响某些视图!