2

ホーム画面ウィジェットからダイアログを起動する必要があるため、アクティビティを作成しましたandroid:theme="@android:style/Theme.Dialog"

問題は、次のように、標準のダイアログウィンドウ(灰色の背景のボタン、フォントとテキストサイズ、パディングなど)のように見せたいことです:

代替テキスト
(ソース: android.com )

これは私の「ダイアログ」アクティビティがどのように見えるかです:

代替テキスト

標準のシステム ダイアログのように見せるための標準的な方法 (テーマ?) はありますか? それとも、自分のレイアウトでそれを模倣する必要がありますか?

4

2 に答える 2

2

以下のボタンは、weight 属性とフレームワーク ドローアブルを背景の背景に使用することで、同じ外観にすることができます。お役に立てれば!

             <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:background="@android:drawable/bottom_bar"
               android:orientation="horizontal">
               <Button
                android:text="Cancel"
                android:textSize="12dip"
                android:id="@+id/cancelButton"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"/>
               <Button
                android:text="Ok"
                android:textSize="12dip"
                android:id="@+id/okButton"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"/>
           </LinearLayout>
于 2011-01-19T09:19:59.653 に答える
0

上部のダイアログはAlertDialog.Builderを使用して構築され、そのクラスを使用する必要がある単純なダイアログを作成します。

于 2010-06-15T13:11:48.880 に答える