On one of my activities i have an edit box that of course when clicked opens up the keyboard. However, even though the keyboard does animate there seems to be a strange lag of the editbox moving up? Ive tried a few different things however to no avail.
Below is my activity and xml files.
ACTIVITY
private TextView countText;
private ListView listView;
private ArrayList<MessagingObject> arrayList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_messaging_page);
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
listView = (ListView) findViewById(R.id.messagingList);
counttext = (TextView) findViewById(R.id.characterCount);
counttext.setVisibility(View.GONE);
final Button sendMessage = (Button) findViewById(R.id.sendMessage_button);
EditText message = (EditText) findViewById(R.id.message_textbox);
Intent intent = getIntent();
String name = intent.getStringExtra("name");
message.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() > 20){
sendMessage.setVisibility(View.GONE);
counttext.setVisibility(View.VISIBLE);
String textOver = new String().valueOf(s.length() - 20);
counttext.setText("-"+textOver+"");
} else {
sendMessage.setVisibility(View.VISIBLE);
counttext.setVisibility(View.GONE);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
startTimer();
arrayList = new ArrayList<MessagingObject>();
getActionBar().setTitle(name);
}
XML DOCUMENT
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6f6f6">
<ListView
android:id="@+id/messagingList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/messageheaderbottom_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:scrollbars="none"
android:divider="@android:color/transparent"
android:dividerHeight="30.0sp"
android:stackFromBottom="true"
android:background="#f6f6f6"
android:overScrollMode="never">
</ListView>
<RelativeLayout
android:id="@+id/messageheaderbottom_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#DEDEDE">
<EditText
android:id="@+id/message_textbox"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:background="@drawable/textfield_rounded"
android:hint="Message"
android:textSize="15dp"
android:maxLength="140"/>
<Button
android:id="@+id/sendMessage_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/message_textbox"
android:layout_marginLeft="18dp"
android:layout_centerVertical="true"
android:text="Send"
android:textSize="18dp"
android:textColor="#344294"
android:background="@android:color/transparent"/>
<TextView
android:id="@+id/characterCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/message_textbox"
android:layout_marginTop="13dp"
android:layout_marginLeft="42dp"
android:textSize="18dp"
android:textColor="#000"/>
</RelativeLayout>
Any suggestions or solutions would be great. Thanks.