我尝试将softInputeMode
属性更改为AdjustResize
和AdjustPan
,但没有任何效果
具有SoftInputMode属性的类:
[Activity(Label = "TextActivity", Theme = "@style/Theme.AppCompat.Transparent.NoActionBar",
MainLauncher =true,ScreenOrientation =Android.Content.PM.ScreenOrientation.FullSensor,
WindowSoftInputMode =SoftInput.AdjustResize & SoftInput.AdjustPan)]
public class TextActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.textsearch_layout);
// Create your application here
}
}
布局:
<?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="#00000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<LinearLayout
android:fitsSystemWindows="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:layout_marginBottom="10dp">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/local_icon">
</ImageButton>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/cloud_icon">
</ImageButton>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/beta_icon">
</ImageButton>
</LinearLayout>
<com.libizo.CustomEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textColor="#ffffff"
android:hint="Test"
android:paddingLeft="15dp"
android:elevation="2dp"
android:fontFamily="@font/opensans_light"
app:libIZO_setBackgroundColor="#992980B9"
app:libIZO_setPrefixTextColor="#ffffff"
app:libIZO_clearIconTint="#ffffff"
app:libIZO_setBorderColor="#E1E0E1"
app:libIZO_setBorderView="true"
app:libIZO_setClearIconVisible="true"
app:libIZO_setCornerRadius="18dp"
app:libIZO_setStrokeWidth="2dp"/>
</LinearLayout>
</RelativeLayout>
答案 0 :(得分:0)
我建议您用 WindowSoftInputMode = SoftInput.StateHidden |代替WindowSoftInputMode = SoftInput.AdjustResize和SoftInput.AdjustPan。 SoftInput.AdjustResize ,然后在最外面的UI上放置 scrollview 层。
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true, ScreenOrientation = Android.Content.PM.ScreenOrientation.FullSensor, WindowSoftInputMode = SoftInput.StateHidden| SoftInput.AdjustResize )]
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<LinearLayout
android:fitsSystemWindows="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:layout_marginBottom="10dp">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/check">
</ImageButton>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/uncheck">
</ImageButton>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/icaon">
</ImageButton>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "11111111"/>
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:imeOptions="actionGo"
android:inputType="text"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>