我在设计应用程序布局时遇到问题。这就是我想要得到的:
=========================================================
| ============= ================ ================ |
| | | | LinearLayout | | LinearLayout | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | ImageView | | ============ | | ============ | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | | | ============ | | ============ | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | | | ============ | | ============ | |
| ============= ================ ================ |
=========================================================
这就是我到目前为止所做的事情(为了清楚起见,我删除了另一个东西):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical" >
<ImageView
android:contentDescription="@string/logo"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="left|center_vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center_vertical"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
</LinearLayout>
</LinearLayout>
我的问题是我想使用高分辨率图像并将它们缩小以匹配它旁边的最高线性布局。我的想法是让 android 在低 dpi 的设备上缩小图像,因此对所有平台使用相同的图像和布局。
就像现在一样,主容器高度与图像高度一样大。我想要的是主容器高度与“最高”线性布局相同,并强制图像视图按比例缩小以适合主容器。
有任何想法吗?
谢谢!
PD:原谅我的英语!:$