1
wie man HorizontalScrollView hinzufügen: Auto-Bildlauf, um zu beenden, wenn neue Ansichten in textview wie dieses Bild hinzugefügt werden möchte ich diese Art von textview es scroll erstellen, wenn ich Text eingeben PLZ jemand helfen mir ?wie man auto texview scroll wie Google Übersetzer hinzufügen
mein Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.textviewdemo.MainActivity">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Name"
android:ems="10"
android:layout_alignParentTop="true"
android:id="@+id/editText"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText"
android:gravity="right|center_vertical"
android:layout_gravity="right|center_vertical"
android:scrollHorizontally="true"
android:textSize="30dp"
android:layout_marginTop="8dp"
android:id="@+id/textView" />
</RelativeLayout>
Meine Hauptaktivität
public class MainActivity extends AppCompatActivity {
EditText editText;
TextView textView;
HorizontalScrollView horizontalScrollView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = (EditText) findViewById(R.id.editText);
textView = (TextView) findViewById(R.id.textView);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
textView.setText(s);
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
}
Danke Es arbeitet –
Sie sind willkommen. :) – tahsinRupam