本文介绍了如何创建已在Android的自动查阅形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用自动查找进行搜索。
我已经部分地创造了这个布局。这是我的XML code。
现在,我该如何使用这个AUTOL查找?

I want to use auto look up for searching .I have partially created this layout . This is my XML code.Now how can i use autol lookup in this?

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:src="@drawable/logo_demo" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageView1"
        android:layout_marginTop="10dp"
        android:background="@drawable/flight_bar"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/roundtripTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="23dp"
            android:layout_marginTop="5dp"
            android:layout_weight="0.01"
            android:text="Round trip"
            android:textColor="@android:color/white" />

        <TextView
            android:id="@+id/OneWayTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="23dp"
            android:layout_marginTop="5dp"
            android:layout_weight="0.01"
            android:text="OneWay"
            android:textColor="@android:color/white" />

        <TextView
            android:id="@+id/multicityTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="23dp"
            android:layout_marginTop="5dp"
            android:layout_weight="0.03"
            android:text="MultiCity"
            android:textColor="@android:color/white" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:id="@+id/linearLayout4"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout1"
        android:background="@drawable/from2"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/fromTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="7dp"
            android:layout_weight=".05"
            android:text="From" />

        <TextView
            android:id="@+id/toTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="7dp"
            android:layout_weight=".05"
    android:text="To" />

    </LinearLayout>
</RelativeLayout>

我必须使用一个自动箱下同到仰望我必须autolook利用起来,在这两个会有图像的中间。所以我这样做,直到从现在到分手我不能够创建单独自动查找下面方框往返。

i have to use a auto look up box same below to the to i have to use autolook up and in the middle of both there will be image .So i have done till from and to part now i am not able to create to separate auto look up box below from and to.

推荐答案

试试这个布局。

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

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:src="@drawable/ic_launcher" />

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@+id/imageView1"
        android:layout_marginTop="10dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/roundtripTextView"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginTop="5dp"
            android:layout_weight="1"
            android:background="#FF0000FF"
            android:gravity="center"
            android:text="Round trip"
            android:textColor="@android:color/white"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/OneWayTextView"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="5dp"
            android:layout_weight="1"
            android:background="#FF0000FF"
            android:gravity="center"
            android:text="OneWay"
            android:textColor="@android:color/white"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/multicityTextView"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="5dp"
            android:layout_weight="1"
            android:background="#FF0000FF"
            android:gravity="center"
            android:text="MultiCity"
            android:textColor="@android:color/white"
            android:textSize="20sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout1"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/linearLayout4"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/fromTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:gravity="center_horizontal"
                android:hint="From" />

            <TextView
                android:id="@+id/textView1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="LON"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <TextView
                android:id="@+id/textView3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="London Great Britain"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </LinearLayout>

        <ImageView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@android:color/darker_gray"
            android:src="@drawable/ic_launcher" />

        <LinearLayout
            android:id="@+id/linearLayout5"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/toTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="7dp"
                android:gravity="center_horizontal"
                android:hint="To" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="DXB"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <TextView
                android:id="@+id/textView4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Dubai United Arab Emirates"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>

修改

把下面的布局后,从/到布局。

Put below layout after "from/to" layout.

<LinearLayout
    android:id="@+id/linearLayout4"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_below="@+id/linear3"
    android:orientation="horizontal" >

    <AutoCompleteTextView
        android:id="@+id/textView1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:gravity="bottom"
        android:text="LON" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@android:color/darker_gray"
        android:src="@drawable/ic_launcher" />

    <AutoCompleteTextView
        android:id="@+id/textView3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:gravity="bottom"
        android:text="DXB" />
</LinearLayout>

这篇关于如何创建已在Android的自动查阅形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 08:51