簡體   English   中英

如何使用錨點布局

[英]How to Use Anchor Layout

我正在努力掌握Anchor布局的用法。 我有以下代碼構造函數:

LokationView()
{


  buildCityUi();
  buildRegionUi();



}

buildCityUi()
{
  cityLbl = new TextView( 'City' );
  addChild( cityLbl );

  cityTxBx = new TextBox( null, 'text' )
  ..profile.width = 'flex '
  ..profile.anchorView = cityLbl
  ..profile.location = 'east center'
  ..on.layout.listen( (_) 
    {
      cityTxBx.width = 200;
      cityTxBx.requestLayout();  
    });


  addChild(cityTxBx );

}

buildRegionUi()
{

  regionLbl = new TextView( 'Region' )
  ..profile.anchorView = cityLbl
  ..profile.location = 'south start';    
  addChild( regionLbl );

  regionTxBx = new TextBox( null, 'text' )
  ..profile.width = 'flex 1'
  ..profile.anchorView = regionLbl
  ..profile.location = 'east center';
  addChild( regionTxBx );
}

我正在嘗試完成以下操作:1.使用相應的TexTBox視圖創建標簽視圖。 2.獲取TextBox視圖以占據瀏覽器空間的其余部分,這些視圖隨瀏覽器寬度的變化而變化。

謝謝

AnchorLayout不是答案。 相反, LinearLayout應該會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM