當我們改變亮度時,它的活動變得透明 所以我們可以看到主屏幕/另一個運行在後面的應用程序。我想要(100%像亮度seekbar一樣)在我的自定義seekbar上。在seekbar變化上顯示透明活動
我的應用主要活動背景顏色爲灰色,
我想在搜索條拖動:我的活動變得透明,並顯示後臺活動/背景主屏幕,
當拖動完成其回在灰色的背景上正常。
我的研究:
我在透明的活動搜索,我發現了許多問題和許多不同的風格和主題的選擇。
這是我最後一次嘗試:
<activity android:name=".Activity"
android:theme="@android:style/Theme.Translucent">
當我跟隨StackOverflow的答案,我得到這個錯誤每次:
"You need to use a Theme.AppCompat theme (or descendant) with this activity."
=>我也試試,透明背景顏色,透明的繪製,從清單透明,
結果:背景顯示白色,不透明
我只有1個主要活動,自定義亮度seekbar和其他選項。
我的清單文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="st.package">
<uses-permission
android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:theme="@android:style/Theme.Translucent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="st.package.ChatHeadService"
android:exported="true">
</service>
<receiver android:name="MainActivity$switchButtonListener" />
</application>
MainActivity.xml
<LinearLayout 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"
tools:context="overlayhead.overlayhead.MainActivity"
android:orientation="vertical"
android:windowIsTranslucent="true"
android:id="@+id/LinearLayout"
android:background="@android:color/transparent"
>
看到這個鏈接,並想想你想要什麼。 1)[刪除seekbar的背景](https://stackoverflow.com/questions/2459326/android-remove-seekbar-background)2)[透明搜索欄](https://stackoverflow.com/questions/26989400/custom -seekbar-thumb-not-transparent-on-lollipop-api21) –
看到這個鏈接,並採取任何想要的想法。 1)[刪除seekbar的背景](https://stackoverflow.com/questions/2459326/android-remove-seekbar-background)2)[透明搜索欄](https://stackoverflow.com/questions/26989400/custom -seekbar-thumb-not-transparent-on-lollipop-api21) –