如何把50%的宽度

Gui*_*res 7 layout android imageview android-layout

我有一个水平方向的LinearLayout和2个ImageView,我想让ImagesView在宽度上填充50%的屏幕,适用于不同大小的每个手机或平板电脑.

像这样的东西:

 +-------------+   
 |_____________|     
 |      |      |  
 | 50%  | 50%  |  
 |      |      |   
 |-------------|
 |             |
 +-------------+
Run Code Online (Sandbox Code Playgroud)

迄今为止最好的:

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


        <ImageView
            android:id="@+id/logo_c"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/logo_animado" />

        <ImageView
            android:id="@+id/logo_t"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/logo_animado2" />


</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Chi*_*hod 14

编写以下代码以在内部的两个视图中执行此操作LinearLayout.

android:layout_width="0dp"
layout_weight="1"
Run Code Online (Sandbox Code Playgroud)