【问题标题】:Button and images are unfit to the layout in android按钮和图像不适合android中的布局
【发布时间】:2013-04-29 12:02:41
【问题描述】:

我在 android 应用程序上创建了。这里我在这个项目上使用了一些按钮和图像, 我的问题是,

我不知道如何提及我的 android 项目中以下文件夹的每个按钮和图像的大小。

可绘制-> 可绘制的 hdpi 可绘制的 mdpi 可绘制的 xhdpi 可绘制的ldpi

** 如果我为每个文件夹使用相同大小的按钮和图像,我的应用程序布局不合适。为什么? 是否有任何标准方式来提及按钮和图像的尺寸?

建议

感谢您宝贵的时间!..

【问题讨论】:

    标签: android image button


    【解决方案1】:

    尝试将按钮的背景创建为nine-patch image,然后将它们放在可绘制文件夹中。

    关于支持不同屏幕尝试阅读this

    【讨论】:

      【解决方案2】:
      <Button 
      android:id="@+id/button"
      android:layout_width="50dp"
      android:layout_height="25dp"
      android:gravity="center"
      android:text="Button"
      android:textSize="12dp"/>
      

      只需在您的 xml 中给出 layout_width、layout_height 值。并且对 ImageView 也一样

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多