【发布时间】:2015-04-21 00:43:10
【问题描述】:
我正在为汽车开发一个应用程序,用户可以在其中注册汽车的车牌号。在主屏幕中,我想显示带有用户车牌的汽车图像(这是一个 textView)。问题是,每当我为某些分辨率修复它时,它就会停止在其他分辨率上工作,有谁知道如何解决这个问题?
这是我的 xml 代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="com.bsbapps.happycars.HomeFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/notify"/>
<Button
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="callSubscribe"
android:text="@string/subscribe"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center">
<ImageView
android:id="@+id/car_image"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/car"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="jfk-4548"
android:textStyle="bold"
android:layout_marginBottom="30dip"
android:layout_alignBottom="@id/car_image"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</LinearLayout>
如果有人想准确复制我所拥有的,这里是图片:
我得到的结果是(在 Nexus 9 上):
并且(在 Nexus 5 上):
【问题讨论】:
标签: android xml imageview android-relativelayout