这是网站搜索的代码。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background=""
tools:context="com.akundi.kameswara.basiccaluculator.MainActivity">
<LinearLayout
android:id="@+id/lLDisplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/zero"
android:textAlignment="viewEnd"
android:textSize="100sp"
android:background="#696969 "
android:textColor="#FFF8DC"/>
</LinearLayout>
<GridLayout
android:id="@+id/gLNumpad"
android:layout_below="@+id/lLDisplay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_gravity="center"
android:alignmentMode="alignBounds"
android:columnCount="4"
android:paddingTop="5dp"
android:rowCount="5"
android:useDefaultMargins="false">
<!-- Row 1-->
<Button
android:id="@+id/btnPower"
android:text="@string/btnPower"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="0"
android:layout_columnSpan="2"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnPercent"
android:text="@string/btnPercent"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="2"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnDivision"
android:text="@string/btnDivision"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="3"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<!-- Row 2-->
<Button
android:id="@+id/btnSeven"
android:text="@string/btnSeven"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="0"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnEight"
android:text="@string/btnEight"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="1"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnNine"
android:text="@string/btnNine"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="2"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnMultiply"
android:text="@string/btnMultiply"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="3"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<!-- Row 3-->
<Button
android:id="@+id/btnFour"
android:text="@string/btnFour"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="0"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnFive"
android:text="@string/btnFive"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="1"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnSix"
android:text="@string/btnSix"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="2"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnSubtract"
android:text="@string/btnSubtract"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="3"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<!-- Row 4-->
<Button
android:id="@+id/btnOne"
android:text="@string/btnOne"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="0"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnTwo"
android:text="@string/btnTwo"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="1"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnThree"
android:text="@string/btnThree"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="2"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnAdd"
android:text="@string/btnAdd"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="3"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<!-- Row 5-->
<Button
android:id="@+id/btnPlusMinus"
android:text="@string/btnPlusMinus"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="0"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnZero"
android:text="@string/btnZero"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="1"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnPeriod"
android:text="@string/btnPeriod"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="2"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
<Button
android:id="@+id/btnEquals"
android:text="@string/btnEquals"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:layout_column="3"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="8dp"/>
</GridLayout>
</RelativeLayout>
如何让它真正搜索我的网站?
答案 0 :(得分:0)
还有许多其他事情要做。
答案 1 :(得分:0)
仅使用HTML创建搜索功能是不可能的。如果您希望它能够正常运行,那么您应该使用PHP。
答案 2 :(得分:0)
您应该查看Solr和ElasticSearch等搜索引擎,并将其集成到您的后端系统中。
http://lucene.apache.org/solr/
Html无法帮助你。您可以用HTML做的唯一事情是将文本字段的内容转发到某些公共搜索引擎(例如谷歌)。 https://www.google.com/search?q=%s
其中%s是您要搜索的字符串。