问题:在可以处理我的两个窗格
更新:我已经解决了
以下是我的XML代码:
Fragment
容器以便将列表视图和选定视图并排显示的设备上,EditView android:hint
当输入文字时会隐藏。然而,在Motorola XOOM和Nexus 7上,android:hint
在插入文本时不会消失。更新:我已经解决了
ListView
调整大小的问题。由于重绘,只是看起来ListView
没有调整大小。然而,我的问题仍然存在,就是EditText
无法隐藏android:hint
。我已经添加了一个更新后的代码和问题截图。为了记录目的,我将保留旧内容,除非其他人认为应该删除。<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/chat_camera_button"
style="android:selectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/camera_button" />
<ImageButton
android:id="@+id/chat_text_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/chat_record_button"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/send_text_button" />
<ImageButton
android:id="@+id/chat_record_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:focusableInTouchMode="true"
android:longClickable="true"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:src="@drawable/mic_disabled" />
<EditText
android:id="@+id/chat_message_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/chat_text_button"
android:layout_toRightOf="@+id/chat_camera_button"
android:ems="10"
android:hint="@string/message_hint"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="3"
android:minLines="1" />
<ListView
android:id="@+id/messages_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/chat_message_text"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll" />
</RelativeLayout>
< p >更新[旧版]:这似乎只局限于我在家里测试的 Droid RAZRs。我已经测试了3个。还有其他人在 Droid RAZR 上遇到问题吗?< /p>
< p >我正在尝试让我的列表视图(List-view)和编辑文本(Edit-text)随着用户输入更多行(最多3行)而重新调整大小。然而,由于某种原因,提示(hint)没有消失,而列表视图(List-view)也没有重新调整大小。< /p>
< p >此外,在我的编辑文本(Edit-text)中使用的 android:hint 不会在有文字时消失。< /p>
< p >以下是错误图片的示例(忽略发送按钮,我不再调整它)< /p>
< p >需要图片的人可以点击这里查看:http://i.stack.imgur.com/e7FJJ.png< /p>
Black - ListView
White - EditText + Button
Green - Text inside EditText
以下是我的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="@+id/details_record_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Send" />
<EditText
android:id="@+id/chat_message_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/details_record_button"
android:ems="10"
android:hint="@string/message_hint"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:inputType="textMultiLine"
android:minLines="1"
android:maxLines="3"
android:textColor="#00FF00"/>
<ListView
android:id="@+id/messages_list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/chat_message_input"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#000000" />
</RelativeLayout>