Frequentist interval via pivotal quantity: An improvement over the interval suggested by @AdamO but still suboptimal solution can be obtained using almost exactly the same method as the one I give here so I omit the details of the following derivation. The pdf of
$$
Z=\frac{X_{(1)}+X_{(n)}}2-\theta,
$$
is
$$
f(z)=n(1-2|z|)^{n-1}
$$
for $-1/2 \le z \le 1/2$.
Since the distribution of $Z$ doesn't depend on $\theta$, $Z$ is a pivotal quantity.
This pdf is symmetric and the upper $\alpha/2$-quantile of $Z$ is $\frac{1-\alpha^{1/n}}2$. Thus
$$
P\left(-\frac{1-\alpha^{1/n}}2<\frac{X_{(1)}+X_{(n)}}2-\theta<\frac{1-\alpha^{1/n}}2\right)=1-\alpha.
$$
Inverting the double inequality, we find that
$$
\frac{X_{(1)}+X_{(n)}}2 \pm \frac{1-\alpha^{1/n}}2 \tag{1}
$$
is a $1-\alpha$ confidence interval for $\theta$. The midrange $(X_{(1)}+X_{(n)})/2$ is not a sufficient statistics for $\theta$, however.
Whittinghill and Hogg: As pointed out by @COOLSerdash, by inverting a likelihood ratio statistic these authors derive the interval
$$\left(x_{(n)}-\frac{(1-\alpha)^{1/n}}2,x_{(1)}+\frac{(1-\alpha)^{1/n}}2\right)\tag{2}$$
which is a function of the sufficient statistic $(X_{(1)},X_{(2)})$ for $\theta$. However, simulations (see below) suggest that this interval is also suboptimal.
A Bayesian credible interval: An alternative is to represent our prior ignorance about $\theta$ by a uniform improper prior $\pi(\theta)=1$. The posterior density of $\theta$ is then
$$
\pi(\theta|\mathbf{x})\propto \prod_{i=1}^n I_{(\theta-\frac12,\theta+\frac12)}(x_i)=I_{(x_{(n)}-\frac12,x_{(1)}+\frac12)}(\theta),
$$
that is, conditional on the observations, $\theta$ is uniformly distributed on the interval from $(x_{(n)}-\frac12,x_{(1)}+\frac12)$. A $1-\alpha$ credible interval for $\theta$ is therefore
$$
\left(x_{(n)}-\frac12 + \frac{\alpha}2L, x_{(1)}+\frac12 - \frac{\alpha}2L\right) \tag{3}
$$
where $L=1-(x_{(n)}-x_{(1)})$. Interestingly, judged by frequentist criteria, based on the following simulation, this interval appear to have the exact nominal coverage but is considerably shorter on average than both (1) and (2):
ci.normal <- function(x, alpha) {
n <- length(x)
mean(x) + c(-1,1)*(12*n)^(-.5)*qnorm(alpha/2, lower.tail = FALSE)
}
ci.pivot <- function(x, alpha=.05) {
n <- length(x)
(min(x)+max(x))/2 + c(-1,1)*(1 - alpha^(1/n))/2
}
ci.wh <- function(x, alpha) {
n <- length(x)
c <- (1-alpha)^(1/n)/2
c(max(x)-c, min(x)+c)
}
ci.bayes <- function(x, alpha=.05) {
L <- 1 - (max(x)-min(x))
c(max(x) - .5 + L*alpha/2, min(x) + .5 - L*alpha/2)
}
coverage <- function(fn, theta=0, nsim=100000, n, alpha=0.05) {
hits <- 0
ci.lengths <- numeric(nsim)
for (i in 1:nsim) {
x <- runif(n, theta-.5, theta+.5)
ci <- fn(x,alpha)
ci.lengths[i] <- ci[2] - ci[1]
if (ci[1] < theta & ci[2] > theta)
hits <- hits + 1
}
list(coverage = hits/nsim, meanlength = mean(ci.lengths))
}
> coverage(ci.normal, n=5)
$coverage
[1] 0.95315
$meanlength
[1] 0.5060605
> coverage(ci.pivot, n=5)
$coverage
[1] 0.95004
$meanlength
[1] 0.4507197
> coverage(ci.wh, n=5)
$coverage
[1] 0.94968
$meanlength
[1] 0.3226174
> coverage(ci.bayes, n=5)
$coverage
[1] 0.94991
$meanlength
[1] 0.3169024