How do I open a text file of any extension in Android?
A programming editor might solve your issue. Take a look at e.g. 920 Text Editor or DroidEdit:

 
920 Text Editor and DroidEdit (Source: Google Play; click images for larger variants)

Both support at least syntax highlighting for several programming languages, and from the screenshot at least DroidEdit seems to be able to directly work with Dropbox (see the headline).