0

我想将文本水平显示为多个图像垂直对齐的图像。Thislayout 没有抛出任何异常,但只有一个图像出现..其他两个图像没有出现在我的布局中。

我的布局 xml:

<?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="wrap_content"

     >
<ScrollView  android:id="@+id/scrollviewmotherregister" android:layout_width="fill_parent" android:layout_height="fill_parent" 
android:layout_marginTop="2dip"  android:layout_marginBottom="2dip">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
 >
    <ImageView
        android:id="@+id/icon"
        android:layout_width="90dip"
        android:layout_height="90dip"
        android:layout_marginLeft="4dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="20dip"
        android:src="@drawable/icici"
         >
    </ImageView>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
     android:orientation="vertical"
     >

     <TextView

        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    </TextView>
      <TextView
        android:id="@+id/label2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ICICI Bank"
        android:textSize="20dip" >
    </TextView>

      <TextView
        android:id="@+id/label3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Timings : 9 AM to 5 PM"
        android:textSize="20dip" >
    </TextView>

     <TextView
        android:id="@+id/label5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:text="Contact Number : 9894198941"
        android:textSize="20dip" >
    </TextView>




    </LinearLayout>

    <ImageView
        android:id="@+id/indianbank"
        android:layout_width="90dip"
        android:layout_height="90dip"
        android:layout_marginLeft="4dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="20dip"
        android:src="@drawable/hdfc"
         >
    </ImageView>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
     android:orientation="vertical"
     >

     <TextView

        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    </TextView>
      <TextView
        android:id="@+id/label2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="HDFC Bank "
        android:textSize="20dip" >
    </TextView>

      <TextView
        android:id="@+id/label3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Timings : 10 AM to 6 PM"
        android:textSize="20dip" >
    </TextView>

     <TextView
        android:id="@+id/label5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:text="Contact Number : 9740999443"
        android:textSize="20dip" >
    </TextView>




    </LinearLayout>

     <ImageView
        android:id="@+id/axisbank"
        android:layout_width="90dip"
        android:layout_height="90dip"
        android:layout_marginLeft="4dip"
        android:layout_marginRight="10dip"
        android:layout_marginTop="20dip"
        android:src="@drawable/axis"
         >
    </ImageView>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
     android:orientation="vertical"
     >

     <TextView

        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    </TextView>
      <TextView
        android:id="@+id/label2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Axis Bank"
        android:textSize="20dip" >
    </TextView>

      <TextView
        android:id="@+id/label3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Timings : 9:30 AM to 5:30 PM"
        android:textSize="20dip" >
    </TextView>

     <TextView
        android:id="@+id/label5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Contact Number : 9003245643"
        android:textSize="20dip" >
    </TextView>




    </LinearLayout>

</LinearLayout>
</ScrollView>
</LinearLayout>

问题 :

I am getting first images but other two images are not showing up .
4

3 回答 3

0

每个LinearLayout 包含 TextViews将每个布局的宽度设置WRAP_CONTENTFILL_PARENT

原因是第一个带有 TextViews 的 LinearLayout 出现了。之后,第一个 LinearLayout 占据了整个空间 - 这就是 Fill_Parent 所以..需要将其更改为 Wrap-Content。

在我看来,这就是问题所在。

于 2012-04-16T05:52:15.903 回答
0

试试 LinearLayout 下的 RelativeLayout。RelativeLayout 具有所有对齐的属性,这将有助于您的目标。

于 2012-04-16T06:36:57.237 回答
0

在滚动视图的线性布局中采用滚动视图采用不同的线性水平布局,,,, 而不是在每个水平布局上采用一个图像+文本视图...

于 2012-04-16T05:41:57.227 回答