android - 满足android屏幕宽度需要多少图像宽度

标签 android android-layout

在 android xml 文件或图形布局上

我想创建一个包含图像的 ImageView 。

我的问题是要满足 Android Mobile 宽度,图像的宽度(以像素为单位)是多少。

最佳答案

由于不同的 Android 设备有不同的屏幕尺寸,您将无法设置绝对宽度来填满屏幕。您可以使用 android:layout_width="match_parent" 作为 ImageView 的宽度,它会自行调整大小以适应它添加到的父 View 。

关于android - 满足android屏幕宽度需要多少图像宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14146432/

相关文章:

android 5 和 xml 布局中的 onClick

android - Android 适配器 getView() 中 2 个布局的动态膨胀

android - 支持 HTML5 的最佳 WebView 设置?

android - 新的 Debug Keystore 是否意味着新的 Map API Key?

java - 在 Button/TextView 上使用 getDimension() 始终返回相同的值

android - 如何在 Android ScrollEvent 上有选择地重绘 View ?

android - 在android中如何搜索sharedpreference是否包含某些值?

Android:将 EditTextPreference 添加为 ListPreference 项

ANDROID 渲染问题 Null Exception

android - 如何在底部应用栏上的 FloatingActionButton(fab)上方显示 Snackbar( Material 设计)