繁体   English   中英

Android:ImageView在景观活动的中心

[英]Android: ImageView in the center of landscape activity

我有一个非常愚蠢的问题。

我无法在景观活动的中心设置ImageView。

我只在活动的左中心和上中心有一个图像。

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:background="@drawable/load_bg"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:orientation="horizontal">

    <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/running_animation"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center_vertical" />

</LinearLayout>

Yuu错过了LinearLayout的android:gravity="center"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/load_bg"
    android:gravity="center"
    android:orientation="horizontal" >

<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/running_animation"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_vertical" />

</LinearLayout>

机器人:layout_gravity = “中心”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM