0
私はビューを中心にしようとしていますが、そうではありません。ルートコンテナはRelativeLayoutです。これは、電話機が縦向きのマルチウィンドウモードになっている場合にのみ発生します。 LinearLayout、RelativeLayout、およびFrameLayoutにビューを配置しようとしましたが、何も機能しません。私は同じレイアウトが横向きのマルチウィンドウモードで動作しているのを驚かせています。重力=肖像画のマルチウィンドウで重力が働いていない
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_relative"
android:background="@color/colorAccentWhite"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:clickable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/name_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="17sp"
android:textColor="@color/black"
android:visibility="invisible" />
</RelativeLayout>
</RelativeLayout>
TextViewは、中央ではなく左上に配置されます。どうすればそれを動作させることができますか?
から「wrap_content」にここで使用されるのTextViewの幅が、私はそれが働いてくれてうれしいです! – GouravJn