IIRC the treatment of homosexuality in Heinlein's writing changed a lot over time. My recollection is that in an early book (possibly Stranger in a Strange Land?), a sympathetic or authorial mouthpiece character refers to gay people as "poor cripples" or "confused" or something along those lines. By the time he wrote I Will Fear No Evil, he was describing humans as having 6 sexes, which are all the combinations of physically M/F with straight/bi/gay.
Can anyone fill in my vague recollections? Is there any evidence as to whether his attitudes actually evolved, or whether there was editorial censorship or self-censorship early on? In the 1942 Beyond This Horizon, there is a scene where two men trade notes on firearms in very macho fashion, and then one of them compliments the other on the shade of his nail polish. This could be taken at face value, or you could read it as Heinlein writing a scene that pushed the envelope as much as possible for marketable genre fiction in 1942. He did fight a series of sometimes ludicrous censorship battles with the freudian-minded editor of his juvenile novels.
[EDIT] A question like this really comprises two questions, one about what the author thought, and one about what he wrote. The link contributed by wcullen to material by Bill Patterson probably tells us as much as we're ever likely to know about #1, so I've edited the question to focus just on #2.