2014-09-19 49 views
0

我创建了一个支持android 2.3到最新的android操作系统的应用程序。但是我的布局有问题。这里是我的XML代码http://pastebin.com/JLHnADNu,这是Android的4 enter image description here按钮显示2之间的不同高度android os

按钮显示,但这一按钮的外观不同的Android 2.3的下面是屏幕截图enter image description here

我的问题是如何在实现同样的结果两个OS。谢谢。

+0

你必须创建布局按照dp像hdpi -mdpi-xhdpi – 2014-09-19 05:45:15

+0

你是否已经为Button应用了高度wrap_content? – Piyush 2014-09-19 05:47:11

+0

@PG_Android是的,但是没有改变高度。 – 2014-09-19 06:03:14

回答

2

试试这个:

<TableLayout 
    android:layout_width="fill_parent" 
    android:background="#428bca" 
    android:stretchColumns="*"> 
    <TableRow> 
     <Button 
      android:id="@+id/simpan_situs" 
      android:textColor="#ffffff" 
      android:background="@android:color/transparent" 
      android:layout_height="50dp" //or whatever the height you want 
      android:text="@string/simpan"/> 
     <Button 
      android:id="@+id/gambar_situs" 
      android:textColor="#ffffff" 
      android:background="@android:color/transparent" 
      android:layout_height="50dp" //or whatever the height you want 
      android:text="@string/gambar"/> 
    </TableRow> 
</TableLayout> 

又读this

+0

您的回答几乎是正确的,我只是为按钮“android:layout_height =”50dp“'添加了相同的高度。谢谢。 – 2014-09-19 06:04:33

+0

尝试向按钮添加android:textSize =“30dp”,正如我在我编辑的答案 – Metehan 2014-09-19 06:06:37

-1

按钮的高度和宽度取决于屏幕大小一样,如果它的MDPI,华电国际,xdpi或xxdpi

+0

中所做的那样,是您的答案吗?或评论 – MilapTank 2014-09-19 06:29:25