If so how were they viewed and treated?
The Roman emperor Elagabalus may have been transgender.
Cassius Dio writes:
When trying someone in court he really had more or less the appearance of a man, but everywhere else he showed affectations in his actions and in the quality of his voice. For instance, he used to dance, not only in the orchestra, but also, in a way, even while walking, performing sacrifices, receiving salutations, or delivering a speech. And finally, — to go back now to the story which I began, — he was bestowed in marriage and was termed wife, mistress, and queen. He worked with wool, sometimes wore a hair-net, and painted his eyes, daubing them with white lead and alkanet. Once, indeed, he shaved his chin and held a festival to mark the event; but after that he had the hairs plucked out, so as to look more like a woman.
...
[Aurelius Zoticus] was appointed cubicularius before he had even been seen by the emperor, was honoured by the name of the latter's grandfather, Avitus, was adorned with garlands as at a festival, and entered the palace lighted by the glare of many torches. Sardanapalus[Elagabalus], on seeing him, sprang up with rhythmic movements, and then, when Aurelius addressed him with the usual salutation, "My Lord Emperor, Hail!" he bent his neck so as to assume a ravishing feminine pose, and turning his eyes upon him with a melting gaze, answered without any hesitation: "Call me not Lord, for I am a Lady."
...
He carried his lewdness to such a point that he asked the physicians to contrive a woman's vagina in his body by means of an incision, promising them large sums for doing so.
As you can see, Dio does not have a positive view, and he was not alone. Elagabalus was unpopular with the Praetorian Guard, and he was assassinated by the Guard and replaced by his cousin, Alexander Severus. He was so unpopular, according to the Historia Augusta, that after death he was subjected to a damnatio memoriae, the systematic removal of his name from the public records.
His name, that is to say the name Antoninus, was erased from the public records by order of the senate— though the name Varius Elagabalus was left —, for he had used the name Antoninus without valid claim, wishing to be thought the son of Antoninus. After his death he was dubbed the Tiberine, the Dragged, the Filthy, and many other such names, all of which were to signify what seemed to have been done during his rule. And he was the only one of all the emperors whose body was dragged through the streets, thrust into a sewer, and hurled into the Tiber. This befell him as a result of the general hatred of all, against which particularly emperors must be on their guard, since those who do not win the love of the senate, the people, and the soldiers do not win the right of burial.
Sources:
http://penelope.uchicago.edu/Thayer/E/Roman/Texts/Cassius_Dio/80*.html
http://penelope.uchicago.edu/Thayer/E/Roman/Texts/Historia_Augusta/Elagabalus/1*.html