我创建了一个意图,该意图在单击按钮时显示,该意图具有如下所示的形状主题
selectAll
不过,唯一的问题是拐角半径显示拐角处的白色背景,我该如何消除呢?我希望它是透明的。
我也添加了它,但是并没有改变角落。
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#4568dc"
android:endColor="#b06ab3"
android:angle="45"/>
<corners android:radius="20dp"/>
</shape>
添加了布局
<style name="AppTheme.PopMe">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
清单
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".AddItemActivity"
android:background="@drawable/popbg">
</android.support.constraint.ConstraintLayout>
FloatingActionBar onClick
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tester.tester">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".AddItemActivity"
android:theme="@style/AppTheme.PopMe"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
和AddItemActivity
public void ShowPopup(View v){
myDialog.setContentView(R.layout.activity_add_item);
categorySpinner = myDialog.findViewById(R.id.spinnerCategory);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.options));
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
categorySpinner.setAdapter(spinnerAdapter);
myDialog.show();
}
答案 0 :(得分:0)
尝试一下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/yourColor"/>
<corners android:radius="7dp"/>
</shape>
</item>
</selector>