你好每一个我是新来的android我构建这个应用程序,我想让我在点击列表时的背景模糊,而不只是透明我让它透明添加
<style name="AppTheme.Popuptheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
在我的style.xml文件中
这是我的弹出类
package com.example.jihad.smsbalanceparser;
import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
/**
* Created by AMD on 1/6/2018.
*/
public class Pop extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popup);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int)(width*.8),(int)(height*.6));
}
}
这是我的AndroidManifest.xml文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.jihad.smsbalanceparser">
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<application
android:allowBackup="true"
android:icon="@drawable/appicon"
android:label="SMS Balance Manager"
android:roundIcon="@drawable/appicon"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".SMSReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name=".Pop" android:theme="@style/AppTheme.Popuptheme" >
</activity>
</application>
</manifest>
最后这是我的popup.xml文件,这是我的弹出式布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:popup="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center"
android:orientation="vertical"
android:padding="5dp"
>
</LinearLayout>