gpt4 book ai didi

Android 图像与手机和平板电脑尺寸不成比例

转载 作者:行者123 更新时间:2023-11-29 19:39:56 25 4
gpt4 key购买 nike

我正在尝试使用 listfragment 显示 ImageView 和 2 个 TextView 。我设计它是为了在平板电脑上显示。看起来不错。但是,如果我用手机看,效果就不一样了。正如您从屏幕截图中看到的那样。

enter image description here

是否可以使手机 View 与平板 View 相同?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:layout_width="0dp"
android:layout_height="200dp"
android:id="@+id/img"
android:src="@drawable/img_1"
android:layout_weight="1" />

<RelativeLayout
android:orientation="horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Name"
android:id="@+id/name"
android:layout_alignParentTop="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Price"
android:id="@+id/price"
android:layout_below="@+id/name" />
</RelativeLayout>
</LinearLayout>

最佳答案

我遇到了同样的事情,我开始了解 sdp,它会根据设备而变化 try this或者您可以通过 this 为不同的屏幕尺寸制作单独的布局。 `

关于Android 图像与手机和平板电脑尺寸不成比例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38733577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com