Resort attire is pretty straightforward--relax, get a tan, and dress up if you feel like it. But if you venture onto a local island or capital Male, you'll want to make a few adjustments.
Only wear a sarong if you can wear two. That is, one covering your top and the other wrapped securely around your bottom half. This is especially important if you plan to tour a mosque--as someone who showed up in pants and a long sleeve shirt but was still wrapped with sarongs, I can guarantee you won't get far in shorts and a T-shirt.
Dress for grandma's house. Your dress, skirt or pants should cover your knees, and your shoulders and chest should not be exposed. A scarf can be a great solution if you only have tank tops, and I highly recommend a light linen shirt with the sleeves rolled up half-way. Jeans will do fine, but lighter materials such as yoga pants or linen will allow enough air to maintain a decent level of comfort. Sandals are perfectly fine. It's also a good idea to bring plenty of sunscreen to avoid the propriety tan.
As an aside, these rules apply for men as well as women. Although dress code for men is less defined, you won't see many adults without a shoulder-covering shirt and long pants.
After 8 pm, the rules change. You'll notice fewer girls in burqas and hijabs, and more couples holding hands. Boys will smoke more openly in cafes. However, the shift in modesty also comes with a shift in attitude. Don't be surprised if the guys who simply stared in daylight are more vocal after dusk. While Male remains fairly safe, avoid Sultan Park or any other quieter, unlit area.
Speaking of attention, members of both sexes will find themselves on the receiving end. Although Maldivians don't tend to be aggressive or vocal, they will mutter as you pass or hush up when you enter a shop. General good practice is to simply smile, say 'hello', and go about your business. Avoid eye contact, especially at night. You could even do as most Maldivian males do: keep your sunglasses on in cafes and enjoy the people watching without being obvious.
When shopping, clerks will follow you closely if you're one of only a few people looking at a clothing item or souvenir. Saying "I'm fine" might get you some space, but in the interest of (albeit awkward) customer service they will keep an eye on you, and always provide a bag as soon as you've got something in your hands. In general, you can count on honesty when it comes to pricing - few Maldivians are out to rip you off. But it's always good to show some skepticism or stick to your guns, depending on the purchase. This is especially good exercise in open markets.