Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20477] Android: Request to support Superscript/Subscript Attributed String

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-09-05T07:43:16.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
LabelsattributedString
ReporterShuo Liang
AssigneeHans Knöchel
Created2016-02-29T00:44:48.000+0000
Updated2016-11-23T18:49:44.000+0000

Description

Customer request our SDK to support Superscript/Subscript Attributed String like we did for Titanium.UI.ATTRIBUTE_UNDERLINES_STYLE. Ref: http://developer.android.com/reference/android/text/style/SuperscriptSpan.html http://developer.android.com/reference/android/text/style/SubscriptSpan.html

Comments

  1. Nazmus Salahin 2016-05-16

    Hello, I think this feature is very much needed to support strings with scientific notations and native android supports this feature. [Chemical Compound](http://i38.tinypic.com/qy8n7m.png) [Scientific Notation of Number](http://android.okhelp.cz/images/img/textview-superscript-issue.jpg) [Mathematical Equation](http://i.stack.imgur.com/Wnsmn.png) Thanks
  2. Hans Knöchel 2016-09-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/8308 [> Expected result <](https://abload.de/img/bildschirmfoto2016-09bsqll.png) Demo:
       var win = Titanium.UI.createWindow({
           backgroundColor: '#ddd',
       });
        
       var attr = Titanium.UI.createAttributedString({
           text: 'x2 + y3, hello world!',
           attributes: [
               {
                   type: Titanium.UI.ATTRIBUTE_SUPERSCRIPT_STYLE,
                   range: [1, 1]
               },
               {
                   type: Titanium.UI.ATTRIBUTE_SUPERSCRIPT_STYLE,
                   range: [6, 1]
               },
               {
                   type: Titanium.UI.ATTRIBUTE_SUBSCRIPT_STYLE,
                   range: [15, 5]
               }
           ]
       });
        
       var label = Titanium.UI.createLabel({
           height: 50,
           color: "#000",
           attributedString: attr
       });
        
       win.add(label);
       win.open();
       
  3. Ashraf Abu 2016-09-05

    PR merged.
  4. Abir Mukherjee 2016-11-23

    Verified using this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.0.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.1.0.v20161122053743 Appcelerator Studio, build: 4.8.0.201611121409 Xcode 8.1 GM Android v6.0.1 I installed the app on the device using the demo code above, and the output matched Hans link "Expected Result".

JSON Source