Android 按钮和图像视图的相对布局在21.0以上不起作用
我面临的问题是,如果我在4.1上用相对布局运行相同的代码,它工作正常,但在21.0上它不工作,并且图像视图隐藏在带有“Match_Parent”的按钮下面 这是我的密码:Android 按钮和图像视图的相对布局在21.0以上不起作用,android,android-relativelayout,Android,Android Relativelayout,我面临的问题是,如果我在4.1上用相对布局运行相同的代码,它工作正常,但在21.0上它不工作,并且图像视图隐藏在带有“Match_Parent”的按钮下面 这是我的密码: <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn_select_pod"
style="@style/basic_button"
android:layout_width="match_parent"
android:background="@drawable/btn_selector"
android:text="Select POD Media " />
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:focusable="true" />
</RelativeLayout>
我发现了问题,现在通过使用
2dp
在imageview
中放置高程来显示图像
android:elevation="2dp"
现在,最后的代码将是
<Button
android:id="@+id/btn_select_pod"
style="@style/basic_button"
android:layout_width="match_parent"
android:background="@drawable/btn_selector"
android:text="Select POD Media " />
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:elevation="2dp"
android:layout_centerVertical="true"
android:focusable="true" />
</RelativeLayout>
希望它也能对您起作用。我发现了这个问题,现在通过使用
2dp
在imageview
中放置高程来显示图像
android:elevation="2dp"
现在,最后的代码将是
<Button
android:id="@+id/btn_select_pod"
style="@style/basic_button"
android:layout_width="match_parent"
android:background="@drawable/btn_selector"
android:text="Select POD Media " />
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:elevation="2dp"
android:layout_centerVertical="true"
android:focusable="true" />
</RelativeLayout>
希望它也能对您起作用。您的按钮样式在21+上相同吗?谢谢@oppoo我发现了问题您的按钮样式在21+上相同吗?谢谢@oppoo我发现了问题