1

このダイアログ レイアウトをコーディングしたい: http://fooh.pl/pokaz/348687655.png

緑のコンテナはオレンジのコンテナに入っています。ダイアログの上部に TextView があります。右上隅にはボタンがあります。

レイアウトの種類は知っていますが、失敗しました。

誰でも私を助けることができますか?お願いします。

4

2 に答える 2

0

良い例や、レイアウトに基づいてダイアログ フラグメントを作成する方法を含むドキュメントへのリンクを次に示します。

そして、ダイアログフラグメントで使用するためにレイアウトを膨張させる方法を示す良いSOの答えがあります

于 2013-04-01T20:46:05.570 に答える
0

どうぞ:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@drawable/rounded_orange">

  <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_margin="8dp"
    android:text="Text"/>

  <RelativeLayout 
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="32dp"
    android:background="@drawable/rounded_green">
  </RelativeLayout>

</RelativeLayout>

ドローアブル (ここでは緑色のみ表示) は次のように配置されます。

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
  <solid android:color="#0F0"/>
  <corners android:radius="16dp"/>
</shape>

カスタムの layout.xml ファイルをダイアログに適用する方法についてサポートが必要な場合は、Dialog の公式ドキュメントの「Creating a Custom Dialog」を参照してください

于 2013-04-01T20:45:29.643 に答える