【发布时间】:2012-04-11 21:58:34
【问题描述】:
我正在尝试为我的应用程序对话框制作自定义对话框形状。我一直在寻找这个主题几个小时,但我找到的解决方案对我不起作用,这就是为什么我问你我自己的问题。 我想要一个带有圆角的对话框并显示一个标题,然后是一个带有一些文本的 ScrollView。唯一对我不起作用的是圆角。 在这里,我将我的代码发布给您:
我的 AndroidManifest.xml 带有我想要的活动以及我的圆角对话框:
<activity
android:name=".AboutNacimiento"
android:label="@string/about_nac_title"
android:theme="@style/Theme.CustomDialogTheme"
android:screenOrientation="nosensor">
</activity>
然后我的资源具有各自的样式 (res/layout/values/dialogTheme.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.CustomDialogTheme"
parent="@android:style/Theme.Dialog">
<item name="android:windowTitleStyle">@style/dialog_title_style</item>
<item name="android:background">@drawable/rounded_dialog</item>
</style>
<style name="dialog_title_style" parent="@android:Widget.TextView">
<item name="android:background">@color/titulo_color</item>
<item name="android:padding">10dip</item>
<item name="android:textSize">20sp</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/texto_blanco</item>
</style>
最后是我想要的圆形对话框的形状 (res/drawable/rounded_dialog.xml):
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/background_color"/>
<stroke android:color="#7F7F7F" android:width="1dp" />
<corners
android:radius="20dp"/>
</shape>
但我得到的唯一“圆形”的东西是 TextViews 中的一些边框......
http://imageshack.us/photo/my-images/515/problemab.jpg
你能帮我得到我想要的对话框吗?
【问题讨论】:
标签: android dialog rounded-corners