您好,登錄后才能下訂單哦!
Absolute布局:
組件的位置可以準確的指定在屏幕的x/y坐標位置
雖然可以精確的去規(guī)定坐標,但是不建議使用。因為不同的設備 不同的分辨率的手機移動設備上不能很好的顯示應有的效果
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Button1"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="button2"
/>
</AbsoluteLayout>
運行結果如下:
layout_x和layout_y屬性:可以設置具體的x/y坐標
代碼如下:
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Button1"
android:layout_x="100dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="button2"
android:layout_y="100dp"
/>
</AbsoluteLayout>
運行如下:
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。