0

我有活动作为对话,所有我喜欢的节目。但是我对它们周围的框架有疑问。就像这里一样。

在此处输入图像描述

我的活动:

public class AlarmAlert extends Activity implements Alarms.AlarmSettings {



    @Override
        protected void onCreate(Bundle icicle) {
            super.onCreate(icicle);

            AlarmAlertWakeLock.acquire(this);

            /*
             * FIXME Intentionally verbose: always log this until we've fully
             * debugged the app failing to start up
             */
            Log.v("AlarmAlert.onCreate()");
            DigitalClock dc = (DigitalClock) findViewById(R.id.digitalClock1);

            mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);

            Intent i = getIntent();
            mAlarmId = i.getIntExtra(Alarms.ID, -1);

            Alarms.getAlarm(getContentResolver(), this, mAlarmId);

            mKlaxon = new AlarmKlaxon();
            mKlaxon.postPlay(this, mAlarmId);

            /* Set the title from the passed in label */
            setTitleFromIntent(i);

            /*
             * allow next alarm to trigger while this activity is active
             */
            Alarms.disableSnoozeAlert(AlarmAlert.this);
            Alarms.disableAlert(AlarmAlert.this, mAlarmId);
            Alarms.setNextAlert(this);

            mKlaxon.setKillerCallback(new AlarmKlaxon.KillerCallback() {
                public void onKilled() {
                    if (Log.LOGV)
                        Log.v("onKilled()");
                    updateSilencedText();

                    /* don't allow snooze */
                    mSnoozeButton.setEnabled(false);
                    dismiss();
                    mState = KILLED;
                }
            });

            updateLayout();

            SharedPreferences settings = getSharedPreferences(
                    AlarmClock.PREFERENCES, 0);
            if (settings.getBoolean(AlarmClock.PREF_SHAKE_SNOOZE, true)) {
                mShakeListener = new ShakeListener(this);
                mShakeListener
                        .setOnShakeListener(new ShakeListener.OnShakeListener() {
                            public void onShake() {
                                snooze();
                                if (mCaptchaSnooze == 0)
                                    finish();
                            }
                        });
            }
        }

        private void setTitleFromIntent(Intent i) {
            mLabel = i.getStringExtra(Alarms.LABEL);
            if (mLabel == null || mLabel.length() == 0) {
                mLabel = getString(R.string.default_label);
            }
            setTitle(mLabel);
        }

        private void updateSilencedText() {
            TextView silenced = (TextView) findViewById(R.id.silencedText);
            silenced.setText(getString(R.string.alarm_alert_alert_silenced,
                    mDuration / 1000 * 60));
            silenced.setVisibility(View.VISIBLE);
        }

        private void updateLayout() {
            setContentView(R.layout.alarm_alert);

我的 alert_alarm.xml(对话框)。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="327dp"
    android:layout_height="295dp"
    android:background="@drawable/alertbg"
    android:gravity="center_horizontal"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/silencedText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingBottom="2dp"
        android:paddingTop="2dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/ltgrey"
        android:visibility="gone" />

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="230dp"
        android:gravity="center_horizontal" >

        <Button
            android:id="@+id/snooze"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="25dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/teesstt"
            android:text="@string/snooze_button"
            android:textColor="#fff"
            android:textSize="25dp"
            android:visibility="visible" />

        <Button
            android:id="@+id/dismiss"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="25dp"
            android:layout_marginTop="20dp"
            android:background="@drawable/teesstt"
            android:text="@string/dismiss_button"
            android:textColor="#fff"
            android:textSize="25dp"
            android:visibility="visible" />
    </RelativeLayout>
    <TextView
        android:id="@+id/tvDD"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/tvDate"
        android:layout_alignLeft="@+id/tvDate"
        android:text="Medium Text"
        android:textSize="20dp"
        android:textColor="#a6a6a6" />
    <TextView
        android:id="@+id/tvDate"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/relativeLayout1"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="55dp"
        android:layout_marginLeft="30dp"
        android:text="Medium Text"
        android:textSize="25dp"
        android:textColor="#a6a6a6" />


    <com.boxclocks.android.alarmclock.dc
        android:id="@+id/digitalClock1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="58dp"
        android:text="DigitalClock"
        android:textColor="#a6a6a6"
        android:textSize="70dp" />

</RelativeLayout>

怎么去掉边框。

4

2 回答 2

3

dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

对话

于 2013-06-21T08:59:05.593 回答
1

你有两个选择。您可以将 Activity 的主题设置为

  Theme_Translucent_NoTitleBar

或者您必须创建一个新主题并使用此处指定的自定义九补丁加载它

如何从对话框中删除边框?

于 2012-11-08T23:12:49.723 回答