The poem sets a small, quiet scene: a crooked little dog asleep on a boat, and the speaker nearby reading a book "against solitude." That phrase works two ways. The book is a defense, a way of keeping loneliness at bay. But "against" also means leaning on something, the way you might rest beside a wall. Reading becomes a kind of company.
Then the word comes back in a funnier, sharper way. Under the trees, an old swan is "against" the speaker for being so close. The swan wants its space, and the speaker, who came looking for ease from solitude, is treated as an intruder. The dog is content and the swan is irritated, and the speaker sits between them.
The mood is gentle and wry. Nothing dramatic happens, but the repeated "against" gives the poem a light humor. Even in a peaceful spot, the speaker seems to say, belonging is never guaranteed.