android 布局常用混淆屬性

來源:互聯網
上載者:User

標籤:android   表   c   和   view   ar   

1、如何控制某一控制項在父控制項中的相對位置呢?  

  在Android系統中提供了layout_margin,用來控制某一控制項邊緣相對於父控制項的邊距。

  其中,

      android:layout_marginTop表示某一控制項相對於父控制項頂部的距離。

      android:layout_marginLeft表示某一控制項相對於父控制項左邊框的距離。

      android:layout_marginRight表示某一控制項相對於父控制項右邊框的距離。

      android:layout_marginButtom表示某一控制項相對於父控制項底部的距離。

 

2、如何控制某一控制項中內容在該控制項中的相對位置呢?

  在Android系統中提供了padding,用來控制某一控制項中內容相對於該控制項邊緣的邊距。

  其中,

      android:paddingTop表示某一控制項中的內容相對於該控制項邊緣頂部的距離。

      android:paddingLeft表示某一控制項中的內容相對於該控制項左邊緣的距離。

      android:paddingRight表示某一控制項中的內容相對於該控制項右邊緣的距離。

      android:paddingButtom表示某一控制項中的內容相對於該控制項邊緣底部的距離。

 

3、android:gravity和android:layout_gravity的區別

  android:gravity用於設定View組件的對齊,而android:layout_gravity用於設定Container組件的對齊。

  如,Button:

       android:gravity:表示Button上面的字在Button中的位置,

       android:layout_gravity:表示Button在介面上的位置。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.