更改Theme.Dialog样式

时间:2013-07-10 13:45:34

标签: android themes

enter image description here

在我的应用程序中,我正在使用设置警报活动。当我按下setalarm按钮时,它会将警报活动显示为Theme.Dialog格式。     我的问题是这个主题只有几个折叠格式的按钮可见。我需要主题作为一个圆角矩形,稍大一点,谢谢......

    <?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"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/tw_taskid"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Task Name:"
            android:textSize="15sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/textviewdis_listname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textSize="15sp"
            android:textStyle="bold" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:weightSum="2" >

        <Button
            android:id="@+id/textviewdateid"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector" />

        <Button
            android:id="@+id/btnid_date"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector"
            android:text="@string/changedate" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/btnid_time"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector" />

        <Button
            android:id="@+id/btnid_changetime"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector"
            android:text="ChangeTime" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:orientation="horizontal"
        android:weightSum="2" >

        <Button
            android:id="@+id/btn_setalarm"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector"
            android:text="Set-Alarm" />

        <Button
            android:id="@+id/btn_CancelAlarm"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@drawable/buttonselector"
            android:text="Cancel-Alarm" >
        </Button>
    </LinearLayout>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

请使用RelativeLayout来定位项目。

使用 Shape 标记为对话视图提供圆角。

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="5dip" />
</shape>

参考链接:how to get rounded dialog theme for activity

相关问题