Michael Lane denies killing Shana Grice, 19, who had her throat slit and her bedroom torched.
A friend of Mr Lane, lay preacher Andrew Birks, told Lewes Crown Court he saw him shortly before she was found.
He told the jury he had waved to Mr Lane, who did not wave back and had appeared to quicken his pace.
He said: "It felt strange, as if I had been ignored."
Later, Mr Lane sent him a friendly text saying "hi, how are you?".
A friend of Miss Grice, Joanne Pumfrey, also gave evidence, saying the victim had felt pressurised by Mr Lane and recounted a occasion when he had puller her hair in a pub.
The prosecution asserts Mr Lane, of Thornhill Rise, Portslade, East Sussex, was "obsessed" with Miss Grice and refused to accept their break-up, or her new relationship with Ashley Cooke.
It is alleged, after months of stalking her, he slit the teenager's throat before setting fire to her bedroom in Chrisdory Road, Portslade, in August.
A neighbour of Miss Grice, Sarah Thompson, told the court earlier that about three weeks before her death she saw and heard arguments at Miss Grice's home.
The trial continues on Monday.
A man accused of murdering his ex-girlfriend was seen acting "strangely" the morning her body was discovered, a court has heard.