Kann mir jemand helfen, unter Menge String-Format in Android-Anwendung zu erreichen.Format Menge Zeichenfolge
Antwort
Android-Smartphones unterstützen einen beliebigen Text in tief- oder hochgestellte schreiben. können Sie versuchen, mit
Html.fromHtml("<sup>$</sup>1,500<sup>00</sup>");
Ohne Verwendung HTML Tag Sie besuchen können Subscript and Superscript a String in Android
Es funktioniert, aber ich brauche die Lösung außer HTML-Tags. –
@ V.J. schauen Sie hier zum Beispiel https://Stackoverflow.com/a/8872986/3383038 –
@OlegOsipenko Gute Infos. –
// Für die Hoch- und Tief Sie können
String yourText="$1,050<sup>00</sup>";
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
yourTextView.setText(Html.fromHtml(yourText,Html.FROM_HTML_MODE_LEGACY))
} else {
yourTextView.setText(Html.fromHtml(yourText));
}
Gerade Hilfe von HTML-Tag nehmen Kopieren Sie es in Ihrem Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:layout_height="match_parent">
<TextView
android:id="@+id/dollar"
android:text="$"
android:textSize="40dp"
android:gravity="top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_toRightOf="@+id/dollar"
android:id="@+id/ammount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80dp"
android:layout_marginTop="-10dp"
android:text="1,050"/>
<TextView
android:layout_toRightOf="@+id/ammount"
android:id="@+id/zeroes"
android:text="00"
android:textSize="40dp"
android:gravity="top"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
@ V.J. Wenn es das ist, was Sie brauchen, akzeptieren Sie es bitte –
Ohhh Entschuldigung. Es ist ein guter Versuch, aber nicht für mich arbeiten. Da ich auch mein Layout ändern muss .. –
- 1. Format Zeichenfolge C++
- 2. Benutzerdefinierte Format Zeichenfolge
- 3. Concatenate Zeichenfolge mit .format
- 4. Format Zeichenfolge von CultureInfo
- 5. Android benutzerdefinierte Zeichenfolge Format
- 6. Falsches Format der Zeichenfolge
- 7. Wie Format Zeichenfolge mit Javascript?
- 8. Format Zeichenfolge in Python-Liste
- 9. Format Zeichenfolge [211659646] -> [211.659.646]
- 10. Format Zeichenfolge Länge in Matlab
- 11. Actionscript 3.0 Zeichenfolge mit Format?
- 12. Format eine Zeichenfolge in C
- 13. Format in Kotlin Zeichenfolge Vorlagen
- 14. Zeichenfolge abgeschnitten im Boost-Format
- 15. Format Zeichenfolge Wert datagridview C#
- 16. Format Zeichenfolge Fall auf INSERT?
- 17. Konvertieren Zeichenfolge mit unbekanntem Format (beliebiges Format) bis zum Datum
- 18. Get Exact Format Zeichenfolge in Bezug auf bestimmte Format-Spezifizierer
- 19. Format Zeichenfolge mit Regex in C#
- 20. NMEA-Format Zeichenfolge von GPS-Daten
- 21. TimeSpan zu ISO8601 Dauer Format Zeichenfolge
- 22. konvertieren Zeichenfolge in java.util.date Format in Java
- 23. Formatieren einer Zeichenfolge in ein bestimmtes Format
- 24. Parse Zeichenfolge im richtigen Format zu DateTime
- 25. Validieren Zeichenfolge ist Base64-Format mit RegEx?
- 26. Nice format eine Ausnahme in eine Zeichenfolge
- 27. Aufruf einer Member-Funktion Format() auf Zeichenfolge
- 28. Validate eine Zeichenfolge basierend auf bestimmten Format
- 29. Python-Format Zeit Zeichenfolge zu Datetime-Objekt
- 30. Python-Ausgabe größere Zeichenfolge als Format Spezifikation
Dies erfordert wahrscheinlich eine spezielle Schriftart für das erhöhte Dollarzeichen und die Nullen. –