我有一个 ImageView 和一个 ImageButton,它们在水平布局中彼此相邻。我想让图片左对齐,按钮右对齐。我尝试设置重力,但好像没有起作用。我错在哪里了?
我有一个 ImageView 和一个 ImageButton,它们在水平布局中彼此相邻。我想让图片左对齐,按钮右对齐。我尝试设置重力,但好像没有起作用。我该怎么解决?
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:gravity="left"
android:src="@drawable/short_logo" />
<ImageButton
android:id="@+id/terminateSeed"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:background="@null"
android:src="@drawable/unregister_icon" />
</LinearLayout>