B
B
bychok3002016-11-26 14:29:34
Java
bychok300, 2016-11-26 14:29:34

How to keep text formatting in TextView?

<resources>
    <string name="app_name">CodeSampler</string>
    <string name="CreateFile">\n
    import java.io.File;\n
    import java.io.IOException;\n
    \n
    public class CreateFileExample{\n
        public static void main( String[] args ){\n
        try {\n
    \n
            File file = new File("c:\\newfile.txt");\n
    \n
            if (file.createNewFile()){\n
                System.out.println("File is created!");\n
            }else{\n
            System.out.println("File already exists.");\n
    }\n
    \n
        } catch (IOException e) {\n
            e.printStackTrace();\n
    }\n
    }\n
    }\n</string>
</resources>

there is such a line, but when viewing it in the application, it is not formatted like here, how to give it the same format? to make a piece of code look nice

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question