使用搜索按钮在编辑文本字段中搜索文本

时间:2016-01-31 14:18:31

标签: android

我是Android编程的新手,我使用android studio。我正在尝试创建一个像google这样的搜索应用,所以当我在编辑文本栏中输入一个单词并单击搜索按钮时,会执行搜索并从google scholar.com或elvesier.com等搜索引擎中显示结果。我已经尝试了这个,我已经创建了UI,所以我需要在搜索栏中输入搜索并单击发送按钮,搜索从谷歌学者或refseek.com等网站进行并显示。

LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="1"
        android:gravity="center">

        <ImageView
            android:layout_width="170dp"
            android:layout_height="197dp"
            android:id="@+id/imageView"
            android:src="@mipmap/ic_launcher1"
            android:layout_weight="0.12" />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="1">

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

            <EditText
                android:layout_width="291dp"
                android:layout_height="wrap_content"
                android:hint="@string/hint_message"
                android:inputType="text"
                android:imeOptions="actionSend" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="@string/button_message"
                />


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

0 个答案:

没有答案