Android 布局设计因列表视图而更改

Android 布局设计因列表视图而更改,android,listview,button,layout,grid-layout,Android,Listview,Button,Layout,Grid Layout,我的布局设计有问题。列表视图可见性消失。单击“搜索视图”时,列表视图变为可见。但是我在底部的两个按钮位置改变了。我不希望在单击搜索视图时键盘上出现这两个按钮 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/linear_4">

我的布局设计有问题。列表视图可见性消失。单击“搜索视图”时,列表视图变为可见。但是我在底部的两个按钮位置改变了。我不希望在单击搜索视图时键盘上出现这两个按钮

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:id="@+id/linear_4">

    <LinearLayout
        android:layout_margin="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/lineear_1">

        <TextView
            android:layout_gravity="center_vertical"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:textSize="18sp"
            android:text="Location..."
            android:id="@+id/tv_konum_gonder_konum"/>

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:foregroundGravity="center_vertical"
            android:layout_marginEnd="5dp"
            android:layout_weight="1"
            android:text="Get Location"
            android:textSize="8sp"
            android:textColor="#ffff"
            android:id="@+id/btn_get_konum"
            android:textColorHint="#fff"
            android:theme="@style/ButtonDisabledStyle"/>

        <Button
            android:layout_gravity="center_vertical"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textSize="8sp"
            android:text="Stop Service"
            android:enabled="false"
            android:layout_marginEnd="5dp"
            android:id="@+id/btn_stop_service_konum_gonder"
            android:textColor="#ffff"
            android:theme="@style/ButtonDisabledStyle"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/linear_3"
        android:layout_below="@id/lineear_1"
        android:layout_marginTop="10dp">

        <SearchView
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:id="@+id/sv_gonder_konum"
            android:layout_gravity="center_vertical">
        </SearchView>

        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_cancel_black_24dp"
            android:layout_margin="5dp"
            android:layout_gravity="center_vertical"
            android:id="@+id/cim_gonder_konum"
            android:visibility="gone"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:orientation="vertical">
        <ListView
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:visibility="gone"
            android:id="@+id/lv_gonder_konum"
            android:background="@drawable/rounded_layout"
            android:layout_below="@id/linear_3"
            android:paddingStart="10dp"
            android:paddingEnd="5dp"
            android:paddingTop="3dp">
        </ListView>
        <GridLayout
            android:layout_below="@id/lv_gonder_konum"
            android:layout_marginTop="10dp"
            android:layout_width="wrap_content"
            android:layout_height="150dp"
            android:columnCount="3"
            android:id="@+id/gl_gonder_konum"
            android:layout_gravity="center_horizontal">
        </GridLayout>
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:id="@+id/linear_2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentStart="true"
    android:layout_marginBottom="34dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/cancel_btn_gonder_konum"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_weight="4"
        android:background="@drawable/rounded_layout"
        android:text="Cancel"
        android:textAlignment="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        tools:ignore="ButtonStyle" />

    <Button
        android:id="@+id/ok_btn_gonder_konum"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        android:layout_weight="4"
        android:background="@drawable/rounded_layout"
        android:text="Ok"
        android:textAlignment="center"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="bold"
        tools:ignore="ButtonStyle" />
</LinearLayout>


在清单中,您可以将
android:windowSoftInputMode=“adjustNothing”
元素添加到您的活动中。参见下面的示例(以下第二行)



在清单中,您可以将
android:windowSoftInputMode=“adjustNothing”
元素添加到您的活动中。参见下面的示例(以下第二行)



不客气。别忘了对答案投赞成票,因为这可能有助于其他人找到解决方案。不幸的是,声誉是不够的。我的应用程序中还有一个问题。我已经试着解决这个问题两周了。你能控制这个链接吗?不客气。别忘了对答案投赞成票,因为这可能有助于其他人找到解决方案。不幸的是,声誉是不够的。我的应用程序中还有一个问题。我已经试着解决这个问题两周了。你能控制这个链接吗?
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
        android:windowSoftInputMode="adjustNothing"  
        android:label="@string/app_name" 
        android:launchMode="singleTop" 
        android:name="com.company.appName.MainActivity" 
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar">

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>