-2
元素始終顯示在屏幕頂部。我嘗試了不同的方法來修復,但運氣不好。我想將元素放置在屏幕的任何位置。這是碎片屏幕。元素始終顯示在分段屏幕的頂部。問題
<FrameLayout 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"
tools:context="myapp.com.myapp1.fragments.AddPeopleFragment">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="159dp"
android:text="three"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginStart="110dp"
android:layout_marginTop="167dp" />
</FrameLayout>
仍然沒有工作。我用了你給我的同樣的例子。 – Jason
順便說一句,你打開了一個'FrameLayout'並關閉了一個'ConstraintLayout' ... –
如果你不在RelativeLayout中,alignParent屬性完全沒有效果,並且layout_editor屬性只會影響編輯器預覽。你應該使用marginStart/Left和marginTop –