Android 键盘出现时屏幕缩小
我在Android应用程序上有以下屏幕: 当我按下SearchView时,屏幕缩小如下: 当键盘出现时,我希望屏幕保持静止(如第一幅图所示)。 以下是我的xml:Android 键盘出现时屏幕缩小,android,xamarin.android,screen,soft-keyboard,shrink,Android,Xamarin.android,Screen,Soft Keyboard,Shrink,我在Android应用程序上有以下屏幕: 当我按下SearchView时,屏幕缩小如下: 当键盘出现时,我希望屏幕保持静止(如第一幅图所示)。 以下是我的xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" androi
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10"
android:minWidth="25px"
android:minHeight="25px">
<SearchView
android:minWidth="25px"
android:minHeight="25px"
android:background="@drawable/rounded_border"
android:clickable="true"
android:iconifiedByDefault="false"
android:focusable="false"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/searchViewCustomers" />
<android.support.v7.widget.RecyclerView
android:id="@+id/customersRecyclerView"
android:scrollbars="vertical"
android:layout_weight="8"
android:layout_width="match_parent"
android:layout_height="0dp" />
<Button
android:text="Нов"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/button1" />
</LinearLayout>
我已经尝试了在互联网上找到的解决方案,但它们不适合我,可能是因为它们适用于Android(Java)。如果有一种方法比使用xml而不是C代码更好
当键盘出现时,我希望屏幕保持静止(如第一幅图所示)
如果不希望屏幕自动调整,可以将活动的WindowSoftInputMode
设置为SoftInput。如下所示调整Nothing
:
[Activity(Label = "Sample", MainLauncher = true,WindowSoftInputMode = SoftInput.AdjustNothing)]
public class MainActivity : Activity
{
RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
...
}