【发布时间】:2015-08-19 15:08:11
【问题描述】:
Hey Guyz 帮帮我,我遇到了对齐设置问题...我是 Android 开发新手,我想要实现的目标是制作一个音乐播放器,我正在尝试将 ImageView 设置为 ImageButton但是我想将它设置在中心并且我没有找到下面的任何方法是我尝试过的代码..
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:alpha="50"
android:id="@+id/imageView1"
android:layout_width="115dp"
android:layout_height="115dp"
android:padding="6dp"
android:src="@drawable/play_btn"
android:background="@null"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/Artist"
android:layout_above="@+id/textView2"
android:layout_centerHorizontal="true" />
</RelativeLayout>
这是我尝试过的,但我找不到任何类似的属性 alignWithMatchCenter = "父 ID" 或 centerInParent = "父 ID"
或者如果我可以在 ImageButton Tag 中添加 ImageView 可以吗?
<ImageButton
android:layout_width="115dp"
android:layout_height="115dp"
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/Artist"
android:layout_above="@+id/textView2"
android:layout_centerHorizontal="true" />
/>
请帮助我的朋友。 任何帮助将不胜感激。 问候, 萨罗什马达拉
【问题讨论】:
-
"...我想把它放在中心...":我不明白你的意思。你是说你想让
ImageView覆盖ImageButton? -
是的,我希望两个控制器的中心相同..
标签: java android xml android-layout alignment