跳到主要内容

レイアウトXML のスキーマ

座標位置の考え方​

レイアウト XML において、top / left / bottom / right / height / width 属性で指定する座標位置は、端末のPortrait 時の横幅を 640 とした論理位置となります。
端末のアスペクト比は、端末によって異なりますので、WebViewの高さが端末によって変化する形になります。

layout 要素​

レイアウト設定ファイルのルート要素になります。

communityButton 要素(非推奨)​

注意

2014 年 7 月 22 日の Shell App Framework の更新により、非推奨となりました。次の節の showCommunityUI の使用を推奨します。

標準コミュニティボタンを表示したい場合は下記の要素をレイアウト XML に追加してください。

<!-- Community button -->
<communityButton gravity="TopLeft" />
属性値必須
gravityコミュニケーションボタンの表示位置です。(TopLeft / TopRight / BottomLeft / BottomRight のいずれか)必須
themeボタンのテーマを指定します。(basic / gray / blue / dark のいずれか)任意
信息

theme 属性が省略された場合のデフォルト値は、basic になります。

showCommunityUI の設置(推奨)​

標準コミュニティボタンを表示しない場合は、以下の要素はレイアウト XML に追加しないでください。追加すると必ずコミュニティボタンが表示されてしまいます。

<!-- Community button -->
<communityButton gravity="TopLeft" />

コミュニティボタンを表示しない場合には、トップ画面もしくはメイン画面から2タップ以内で Mobage コミュニティが表示できるような導線をゲーム内に設置する必要があります。Mobage コミュニティの呼び出しは mobage.shellapp.Service.showCommunityUI メソッドで行います。
詳細は下記のドキュメントを参照してください。

  • Mobageへの導線設置とログアウトボタン

  • showCommunityUI
     

    webview 要素​

    WebView のレイアウト情報を指定する要素です。layout 要素の子要素であり、必須(1..1)です。

    属性値必須
    topWebView の top 位置を指定します。(数値)必須
    leftWebView の left 位置を指定します。(数値)必須
    bottomWebView の bottom 位置を指定します。(数値)必須
    rightWebView の right 位置を指定します。(数値)必須
    scalesToFitviewportを有効にするかのフラグです。省略した場合はfalseになります。(true/false)任意
    backkeyToExitAndroidのBackキーを押した際にアプリケーションを即座終了するかのフラグです。省略した場合はfalseになります。true の場合は、BackKeyを押すとアプリケーション終了確認のダイアログが表示されます。false の場合は、WebViewのブラウザーバックの挙動になり、戻る画面がなくなった時点でアプリケーション終了確認のダイアログが表示されます。任意

header 要素​

ヘッダのレイアウト情報を指定する要素です。layout 要素の子要素であり、任意の数の要素(0..-)が定義可能です。

  • アプリケーション起動時に表示するヘッダのレイアウトを指定するため、header要素が複数ある場合は、必ず1つの要素に対してdefault属性をtrueにしなければなりません。
  • 複数のheader要素に対してdefault属性をtrueにした場合の動作は保証されません。
  • ヘッダが不要な場合は、header要素を定義しないでください。
属性値必須
nameヘッダの名前を指定します。("main" / "battle" などの任意の文字列)必須
defaultアプリケーション起動時のデフォルトのヘッダであることを設定します。省略した場合はfalseになります。(true/false)任意
backgroundヘッダに使用する画像のファイル名を指定します。("header_base.png”などの文字列)必須
topヘッダの top 位置を指定します。(数値)必須
leftヘッダの left 位置を指定します。(数値)必須
heightヘッダの高さを指定します。(数値)必須
widthヘッダの幅を指定します。(数値)必須

button 要素 (ヘッダ用)​

ボタンのレイアウト情報を指定する要素です。header 要素の子要素であり、任意の数の要素(0..-)が定義可能です。

属性値必須
normalボタンの通常時の画像ファイルを指定します。("header_button1.png”などの文字列)必須
overボタンのタップ時の画像ファイルを指定します。省略した場合は、タップ時もnormalの画像のままになります。("header_button_over1.png”などの文字列)任意
topボタンの top 位置を指定します。(数値)必須
leftボタンの left 位置を指定します。(数値)必須
heightボタンの高さを指定します。(数値)必須
widthボタンの幅を指定します。(数値)必須
hrefボタンの挙動を指定します。(下記 href に指定可能な値参照)必須
hrefSandboxボタンの挙動を指定します。(Sandbox用)(下記 href に指定可能な値参照)任意
soundeffectボタンのタップ時に再生するサウンドファイルを指定します。("select.ogg”などの文字列)任意
  • hrefSandbox 属性が省略された場合は、Sandbox環境でも href 属性の値が有効になります。

href に指定可能な値​

値機能
topgadget.xmlのstartUrlへ遷移します
back前のページに遷移します
reload現在のページを再読み込みします
forward先のページに遷移します
showBankUIモバコイン購入画面をダイアログ形式で表示します
(Javascript)javascript: func(); 形式の指定が可能です
(URL)遷移先の任意のゲームサーバーのURLを指定可能です。(GadgetサーバーのURLは含まず、URLエンコードも不要です)

フッタのレイアウト情報を指定する要素です。layout 要素の子要素であり、任意の数の要素(0..-)が定義可能です。

  • アプリケーション起動時に表示するフッタのレイアウトを指定するため、footer要素が複数ある場合は、必ず1つの要素に対してdefault属性をtrueにしなければなりません。
  • 複数のfooter要素に対してdefault属性をtrueにした場合の動作は保証されません。
  • フッタが不要な場合は、footer要素を定義しないでください。
属性値必須
nameフッタの名前を指定します。("main" / "battle" などの任意の文字列)必須
defaultアプリケーション起動時のデフォルトのフッタであることを設定します。省略した場合はfalseになります。(true/false)任意
backgroundフッタに使用する画像のファイル名を指定します。("header_base.png”などの文字列)必須
bottomフッタの bottom 位置を指定します。(数値)必須
leftフッタの left 位置を指定します。(数値)必須
heightフッタの高さを指定します。(数値)必須
widthフッタの幅を指定します。(数値)必須

button 要素 (フッタ用)​

ボタンのレイアウト情報を指定する要素です。footer 要素の子要素であり、任意の数の要素(0..-)が定義可能です。

属性値必須
normalボタンの通常時の画像ファイルを指定します。("header_button1.png”などの文字列)必須
overボタンのタップ時の画像ファイルを指定します。省略した場合は、タップ時もnormalの画像のままになります。("header_button_over1.png”などの文字列)任意
bottomボタンの bottom 位置を指定します。(数値)必須
leftボタンの left 位置を指定します。(数値)必須
heightボタンの高さを指定します。(数値)必須
widthボタンの幅を指定します。(数値)必須
hrefボタンの挙動を指定します。(下記 href に指定可能な値参照)必須
hrefSandboxボタンの挙動を指定します。(Sandbox用)(下記 href に指定可能な値参照)任意
soundeffectボタンのタップ時に再生するサウンドファイルを指定します。("select.ogg”などの文字列)任意
  • hrefSandbox 属性が省略された場合は、Sandbox環境でも href 属性の値が有効になります。

href に指定可能な値​

値機能
topgadget.xmlのstartUrlへ遷移します
back前のページに遷移します
reload現在のページを再読み込みします
forward先のページに遷移します
showBankUIモバコイン購入画面をダイアログ形式で表示します
(Javascript)javascript: func(); 形式の指定が可能です
(URL)遷移先の任意のゲームサーバーのURLを指定可能です。(GadgetサーバーのURLは含まず、URLエンコードも不要です)

レイアウト設定ファイルのサンプル​

レイアウト設定 XML ファイルのサンプルは下記のようになります。※ コミュニティボタンは表示されません

<layout>
<!-- WebView layout -->
<webview
bottom="120"
left="0"
right="0"
scalesToFit="true"
backkeyToExit="true"
top="120" />
<!-- Header 1 -->
<header
name="main"
background="ui_black_header_base.png"
default="true"
height="120"
left="0"
top="0"
width="640" >
<button
height="62"
href="back"
left="130"
normal="ui_black_header_back.png"
over="ui_black_header_back_on.png"
soundeffect="select.ogg"
top="10"
width="119" />
<button
height="62"
href="top"
left="256"
normal="ui_black_header_home.png"
over="ui_black_header_home_on.png"
soundeffect="start.ogg"
top="10"
width="119" />
<button
height="62"
href="forward"
left="382"
normal="ui_black_header_next.png"
over="ui_black_header_next_on.png"
soundeffect="select.ogg"
top="10"
width="119" />
<button
height="116"
href="showBankUI"
left="514"
normal="ui_black_header_info.png"
over="ui_black_header_info_on.png"
soundeffect="select.ogg"
top="0"
width="116" />
</header>

<!-- Header 2 -->
<header
name="header2"
background="ui_beige_header_base.png"
default="false"
height="120"
left="0"
top="0"
width="640" >
<button
height="62"
href="back"
left="130"
normal="ui_beige_header_back.png"
over="ui_beige_header_back_on.png"
soundeffect="select.ogg"
top="10"
width="119" />
<button
height="62"
href="top"
left="256"
normal="ui_beige_header_home.png"
over="ui_beige_header_home_on.png"
soundeffect="start.ogg"
top="10"
width="119" />
<button
height="62"
href="forward"
left="382"
normal="ui_beige_header_next.png"
over="ui_beige_header_next_on.png"
soundeffect="select.ogg"
top="10"
width="119" />
<button
height="116"
href="showBankUI"
left="514"
normal="ui_beige_header_info.png"
over="ui_beige_header_info_on.png"
soundeffect="select.ogg"
top="0"
width="116" />
</header>
<!-- Footer 1 -->
<footer
name="main"
background="ui_black_footer_base.png"
bottom="0"
default="true"
height="120"
left="0"
width="640" >
<button
height="53"
href="http://gameserver.com/mypage.php"
hrefSandbox="http://dev.gameserver.com/mypage.php"
left="9"
normal="ui_black_footer_icon1.png"
over="ui_black_footer_icon1_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/quest.php"
hrefSandbox="http://dev.gameserver.com/quest.php"
left="135"
normal="ui_black_footer_icon2.png"
over="ui_black_footer_icon2_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/battle.php"
hrefSandbox="http://dev.gameserver.com/battle.php"
left="261"
normal="ui_black_footer_icon3.png"
over="ui_beige_footer_icon3_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/shop.php"
hrefSandbox="http://dev.gameserver.com/shop.php"
left="387"
normal="ui_black_footer_icon4.png"
over="ui_black_footer_icon4_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/friends.php"
hrefSandbox="http://dev.gameserver.com/friends.php"
left="513"
normal="ui_black_footer_icon5.png"
over="ui_black_footer_icon5_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="42"
href="javascript:openMenu();"
left="233"
normal="ui_black_footer_menu.png"
over="ui_black_footer_menu_on.png"
soundeffect="start.ogg"
bottom="68"
width="175" />
</footer>
<!-- Footer 2 -->
<footer
name="footer2"
background="ui_beige_footer_base.png"
bottom="0"
default="false"
height="120"
left="0"
width="640" >
<button
height="53"
href="http://gameserver.com/mypage.php"
hrefSandbox="http://dev.gameserver.com/mypage.php"
left="9"
normal="ui_beige_footer_icon1.png"
over="ui_beige_footer_icon1_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/quest.php"
hrefSandbox="http://dev.gameserver.com/quest.php"
left="135"
normal="ui_beige_footer_icon2.png"
over="ui_beige_footer_icon2_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/battle.php"
hrefSandbox="http://dev.gameserver.com/battle.php"
left="261"
normal="ui_beige_footer_icon3.png"
over="ui_beige_footer_icon3_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/shop.php"
hrefSandbox="http://dev.gameserver.com/shop.php"
left="387"
normal="ui_beige_footer_icon4.png"
over="ui_beige_footer_icon4_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="53"
href="http://gameserver.com/friends.php"
hrefSandbox="http://dev.gameserver.com/friends.php"
left="513"
normal="ui_beige_footer_icon5.png"
over="ui_beige_footer_icon5_on.png"
soundeffect="select.ogg"
bottom="5"
width="119" />
<button
height="42"
href="javascript:openMenu();"
left="233"
normal="ui_beige_footer_menu.png"
over="ui_beige_footer_menu_on.png"
soundeffect="start.ogg"
bottom="68"
width="175" />
</footer>
</layout>

更新履歴​

  • 2014/07/23
    • communityButton 要素に関する仕様変更
  • 2012/12/11
    • 新規作成
  • 座標位置の考え方
  • layout 要素
  • communityButton 要素(非推奨)
  • showCommunityUI の設置(推奨)
  • webview 要素
  • header 要素
  • button 要素 (ヘッダ用)
    • href に指定可能な値
  • footer 要素
  • button 要素 (フッタ用)
    • href に指定可能な値
  • レイアウト設定ファイルのサンプル
  • 更新履歴