【发布时间】:2015-12-18 01:50:42
【问题描述】:
但是,当用户单击 EditText 时,视图会中断并显示如下。在我的活动清单中,我添加了以下 android:windowSoftInputMode="adjustResize"
我想要发生的是,底部的两个按钮都会出现,并且当用户单击 EditText 时,整个 Edittext 都是可见的而不会被剪切。
编辑:将以下行添加到我的活动 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); 使我的视图看起来像这样。但我仍然希望我的两个按钮出现在 EditText 的底部
底部 EditText 和按钮的 XML
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.6 "
android:background="#FFFFFF"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<EditText
android:hint="Enter your Message"
android:ems="10"
android:id="@+id/messageET"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<RelativeLayout
android:background="@drawable/lightrectangle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2.5">
<ImageButton
android:id="@+id/addimgbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#f6f6f6"
android:paddingLeft="10dp"
android:src="@mipmap/blueadd" />
<TextView
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Add an image"
android:id="@+id/textView4"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/addimgbtn"
/>
</RelativeLayout>
<RelativeLayout
android:background="@drawable/lightrectangle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2.5">
<ImageButton
android:id="@+id/sendbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:layout_weight="2.5"
android:background="#f6f6f6"
android:src="@mipmap/bluesend" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Send Message"
android:id="@+id/sendmsgTV"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/sendbtn"
android:paddingLeft="10dp"
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
【问题讨论】:
-
您将不得不发布至少一个简化版的布局。调整大小是您想要的,但需要有一个实际上可以调整大小的视图。
-
@GabeSechan 我需要调整什么大小?
-
该中心列表需要可收缩。
-
一个简单的例子是,如果这一切都是我的亲戚,按钮与专利底部对齐,文本视图上方的列表并设置为填充专利。这会起作用(该列表将占用所有可用空间
-
@GabeSechan 检查编辑后的回复
标签: android android-softkeyboard window-resize