I have a very stupid problem.
I can't set an ImageView in the center of landscape acitivity.
I have an image only in the left-center and up-center of activity.
<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're missing the android:gravity="center"
for the LinearLayout
<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 = “中心”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.