NoWo
- Forum-Beiträge: 17
24.01.2012, 13:57:07 via Website
24.01.2012 13:57:07 via Website
Hallo zusammen,
ich wollte mal nachfragen, wie es möglich ist, Text automatisch zu kürzen.
Ich habe im Internet bereits ein paar Möglichkeiten gefunden, allerdings funktionierten diese nicht.
Hier meine xml:
Diese wird wie folgt von der Java-Klasse gefüllt:
Vielen Dank,
NoWo
ich wollte mal nachfragen, wie es möglich ist, Text automatisch zu kürzen.
Ich habe im Internet bereits ein paar Möglichkeiten gefunden, allerdings funktionierten diese nicht.
Hier meine xml:
1<?xml version="1.0" encoding="utf-8"?>
2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content">
5
6<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
7 android:layout_width="fill_parent"
8 android:layout_height="fill_parent"
9 android:orientation="vertical">
10
11
12<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
13 android:id="@+id/TableLayout_als_einzukaufend"
14 android:layout_width="wrap_content"
15 android:layout_weight="1"
16 android:stretchColumns="3"
17 android:layout_height="wrap_content"
18 android:layout_marginTop="20dp">
19
20 <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
21 <TextView
22 android:layout_width="wrap_content"
23 android:layout_height="wrap_content"
24 android:layout_marginTop="20dp"
25 android:text=" " />
26 </TableRow>
27</TableLayout>
28</LinearLayout>
29</ScrollView>
2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content">
5
6<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
7 android:layout_width="fill_parent"
8 android:layout_height="fill_parent"
9 android:orientation="vertical">
10
11
12<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
13 android:id="@+id/TableLayout_als_einzukaufend"
14 android:layout_width="wrap_content"
15 android:layout_weight="1"
16 android:stretchColumns="3"
17 android:layout_height="wrap_content"
18 android:layout_marginTop="20dp">
19
20 <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content">
21 <TextView
22 android:layout_width="wrap_content"
23 android:layout_height="wrap_content"
24 android:layout_marginTop="20dp"
25 android:text=" " />
26 </TableRow>
27</TableLayout>
28</LinearLayout>
29</ScrollView>
Diese wird wie folgt von der Java-Klasse gefüllt:
1TableLayout table = (TableLayout)findViewById(R.id.TableLayout_als_einzukaufend);
2LinearLayout cell = new LinearLayout(this);
3TextView tv = new TextView(this);
4
5TableRow tr = new TableRow(this);
6tr.setBackgroundColor(Color.BLACK);
7tr.setPadding(0, 0, 0, 2); //Border between rows
8
9tr = new TableRow(this);
10tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
11
12TextView td_id = new TextView(this);
13td_id.setText("ID");
14tr.addView(td_id);
15
16TextView td_haendler = new TextView(this);
17td_haendler.setText("Text, der ggf. gekürzt werden soll !!!");
18td_haendler.setTextSize(15);
19tr.addView(td_haendler);
20
21TextView td_menge = new TextView(this);
22td_menge.setText("weiterer Text, nicht zu kürzen");
23td_menge.setTextSize(15);
24td_menge.setGravity(Gravity.CENTER);
25tr.addView(td_menge);
26
27table.addView(tr);
2LinearLayout cell = new LinearLayout(this);
3TextView tv = new TextView(this);
4
5TableRow tr = new TableRow(this);
6tr.setBackgroundColor(Color.BLACK);
7tr.setPadding(0, 0, 0, 2); //Border between rows
8
9tr = new TableRow(this);
10tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
11
12TextView td_id = new TextView(this);
13td_id.setText("ID");
14tr.addView(td_id);
15
16TextView td_haendler = new TextView(this);
17td_haendler.setText("Text, der ggf. gekürzt werden soll !!!");
18td_haendler.setTextSize(15);
19tr.addView(td_haendler);
20
21TextView td_menge = new TextView(this);
22td_menge.setText("weiterer Text, nicht zu kürzen");
23td_menge.setTextSize(15);
24td_menge.setGravity(Gravity.CENTER);
25tr.addView(td_menge);
26
27table.addView(tr);
Vielen Dank,
NoWo
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.