Java 如何修复操作栏?更新 更新:我找到了答案,但排名太低,无法分享我的答案。
我有一个简单的笔记应用程序,我在滚动和操作栏方面遇到了问题。我想为行动栏是固定的看到整个时间,甚至当我向下滚动我的笔记或当我想复制和粘贴 以下是我目前掌握的代码:Java 如何修复操作栏?更新 更新:我找到了答案,但排名太低,无法分享我的答案。,java,android,xml,Java,Android,Xml,我有一个简单的笔记应用程序,我在滚动和操作栏方面遇到了问题。我想为行动栏是固定的看到整个时间,甚至当我向下滚动我的笔记或当我想复制和粘贴 以下是我目前掌握的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <EditTe
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/noteText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ems="7"
android:singleLine="false"
android:gravity="top"
android:lineSpacingExtra="7dp"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect" >
<requestFocus />
</EditText>
</RelativeLayout>
我不得不将滚动视图添加到笔记应用程序中
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_note_editor);
Intent intent = this.getIntent();
note = new Noteitem();
note.setKey(intent.getStringExtra("key"));
note.setText(intent.getStringExtra("text"));
EditText et = (EditText) findViewById(R.id.noteText);
et.setText(note.getText());
et.setSelection(note.getText().length());
ScrollView scrollable_contents = (ScrollView) findViewById(R.id.text_view);
getLayoutInflater().inflate(R.layout.activity_note_editor, scrollable_contents);
}
听起来您需要向EditText元素添加垂直滚动条 添加以下内容:
android:scrollbars="vertical"
因此,完整的元素将如下所示:
<EditText
android:id="@+id/noteText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ems="7"
android:singleLine="false"
android:gravity="top"
android:lineSpacingExtra="7dp"
android:scrollbars="vertical"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect" >
在这种情况下,xml内容并不重要。提供您的活动代码。Java@marson我只是根据请求添加了java代码。谢谢你的帮助。@marson谢谢你的建议!我想出来了。
<EditText
android:id="@+id/noteText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ems="7"
android:singleLine="false"
android:gravity="top"
android:lineSpacingExtra="7dp"
android:scrollbars="vertical"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect" >