The accuracy through a divider isn’t bad, but it’s a trade off - the more current through the divider, the more accurate (as the current into the ADC becomes negligible) but the more drain the divider places on the battery.
The best way to solve that is to use a fairly low value divider (for accuracy) and a high side switch, which disconnects the top of the divider when you’re not sampling the voltage. You have to do it this way (vs a low side switch which is easier) as otherwise you’ll end up putting the battery voltage, albeit through a resistor, on the ADC pin, which isn’t good for the processor.
The easiest way to do this is with two FETs, a PFET (to gate the power) and an NFET (to drive the PFET), like this:
(full schematic here https://www.electricimp.com/docs/hardware/resources/reference-designs/lala/ for this exact example, 4xAA to be sampled by a 3.3v ADC).
The high side switch is Q80 & Q81 in the bottom right of the schematic, and the divider scales the battery voltage down by a factor of (2.2/(4.7+2.2))=0.319; even worst-case (4xEnergizer lithiums at 1.7v) you’ll have 2.17v on the ADC pin. D80/R81 are not part of the sampling circuit, but show how you might save IO pins by dual-purposing a status LED with the high side switch enable.
Q81 isn’t labelled on the schematic but the BOM calls it out as an NXP PMV160UP. When the LED_STATUS line is driven high, Q80 - the NFET - turns on, shorting the gate of Q81 (which is normally pulled up to VBAT by R82) to ground. This turns Q81 - the PFET - on, powering the resistor divider formed by R83 & R84. The gate of Q80 is pulled low so that when LED_STATUS isn’t driven Q80 is turned off, minimizing current draw; effectively, this circuit takes no power at all when not in use.
The only problem with FETs is that breadboardable ones with decent thresholds are almost impossible to find. I think these are both SOT23’s, which are fairly small…