我正在使用带有布局的弹出窗口Activity class
,当按下button
时,会出现一个弹出窗口。我想要的是编辑shape
弹出窗口的RelativeLayout
。感谢
这是我的pop_up.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="@drawable/layout_shape"
tools:context="com.example.computer.mathkiddofinal.FinalResults.Final_Result_Grade_4">
</RelativeLayout>
这是我的layout_shape
<solid
android:color="#00B0BE" >
</solid>
<stroke
android:width="2dp"
android:color="#C4CDE0" >
</stroke>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" >
</padding>
<corners
android:radius="40dp" >
</corners>
</shape>
我的XML屏幕截图,我想删除侧面的空白,我从布局背景知道它,我可以使用透明度吗?因为这会弹出其他布局活动,所以我只需要蓝色的形状。顺便说一句,布局代码来自@Sabari,谢谢
答案 0 :(得分:1)
试试这个: -
添加自定义可绘制
custom_shape.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="#00B0BE" >
</solid>
<stroke
android:width="2dp"
android:color="#C4CDE0" >
</stroke>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" >
</padding>
<corners
android:radius="40dp" >
</corners>
</shape>
并为RelativeLayout
添加背景<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_shape">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Testing" />
</RelativeLayout>
</RelativeLayout>
答案 1 :(得分:0)
只需改变你的,
layout_shape ,如下所示,
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listview_background_shape">
<stroke
android:width="2dp"
android:color="#ff207d94" />
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<corners android:radius="5dp" />
<solid android:color="#2eb8b8"></solid>
<corners android:radius="30dp"></corners>
</shape>
<强> pop_up.xml 强>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000">
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/layout_shape"
tools:context="com.example.computer.mathkiddofinal.FinalResults.Final_Result_Grade_4">
</RelativeLayout>
</RelativeLayout>
答案 2 :(得分:0)
您只需要减少自定义形状中角落的半径
textarea