首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android中将图像对齐为垂直中心的麻烦

在android中将图像对齐为垂直中心的麻烦
EN

Stack Overflow用户
提问于 2016-03-24 07:45:56
回答 2查看 23关注 0票数 0

我不能对齐图像垂直centered.What,我在这里丢失?

代码语言:javascript
复制
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_marginTop="35dp"
    android:layout_height="fill_parent">
    <Spinner
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:id="@+id/moviesSpinner"
        android:prompt="@string/movie_prompt" />
    <ImageView
        android:layout_gravity="center_vertical"
        android:gravity="center_vertical"
        android:layout_alignParentRight="true"
        android:src="@drawable/Arrowcircled"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:id="@+id/imageView1" />
</RelativeLayout>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-03-24 07:51:26

如果添加大小为spinner的父spinner,则可以这样做

代码语言:javascript
复制
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginTop="35dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Spinner
            android:id="@+id/moviesSpinner"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:prompt="@string/movie_prompt"/>

        <ImageView
            android:id="@+id/imageView1"

            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_gravity="center_vertical"
            android:src="@drawable/bemoir_splash3"/>
    </RelativeLayout>
</RelativeLayout>
票数 0
EN

Stack Overflow用户

发布于 2016-03-24 07:50:34

试试!!

代码语言:javascript
复制
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_marginTop="35dp"
android:layout_height="fill_parent">
<Spinner
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:id="@+id/moviesSpinner"
    android:prompt="@string/movie_prompt" />
<ImageView
    android:src="@drawable/Arrowcircled"
    android:layout_width="20dp"
    android:layout_centerInParent="true"
    android:layout_below="@+id/moviesSpinner"
    android:layout_height="20dp"
    android:id="@+id/imageView1" />

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36195331

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档