2016-11-15 85 views
0

我有一个图像视图和一个textView。使图像视图看起来在每个设备相同

当我在更大的设备上测试它时,图像改变了他的位置。

布局的xml:

<TextView 
    android:id="@+id/monedas_pow" 
    android:text="300" 
    android:textSize="29sp" 
    android:layout_marginLeft="10dp" 
    android:textColor="@color/titlecolor" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
<ImageView 
    android:id="@+id/summary_btn" 
    android:src="@drawable/coin" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="525dp" 
    android:layout_toRightOf="@id/monedas_pow" 
    android:layout_marginTop="8dp" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="280dp" /> 

It have to look like this

+0

的[我如何使用复合绘制的,而不是一个包含的ImageView和一个TextView一个的LinearLayout(HTTP可能重复:// stackoverflow.com/questions/8318765/how-do-i-use-a-compound-drawable-instead-of-a-linearlayout-that-c​​ontains-an-imag) –

+0

您必须为不同的设备创建不同的文件夹,其中包含设备样式,尺寸等。 – HaroldSer

+0

marginBottom是你有的问题。 –

回答

0

它,因为你必须在底部和右侧巨大的利润。只是删除底部和右页边距,并添加android:layout_alignBaseline="@+id/monedas_pow" 而且你缺少+在toRightOf所以它添加android:layout_toRightOf="@+id/monedas_pow"

+0

但是,我怎么能使它在每个设备上工作,而不仅仅是在我的。我是一个begginer –

+0

你在屏幕上的哪个位置试图放置这些视图? –

+0

在左上角 –

0

使用的RelativeLayout,在指定align_centerInParent =真正的text_view和使用layout_below =“文本视图id”你image_view。 例子:

尝试this..hope它会工作

相关问题