开发者

Resize TextView to fullscreen when double tapping on it

I'm developping an App which shows in the screen a log. This log is displayed in a TextView which is 开发者_运维知识库inside a ScrollView. The TextView's size is about half of the screen as I have designed it in the layout file.

I would like to resize the TextView to fullscreen when a double tap it's done over the TextView but I can't find a way to do this.

Does anyone know a solution?

Thanks.


Did you try LayoutParameter? Well I am not sure e.g

scrollView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);


Double tap is not a supported event type. Consider useing LongClick instead. But if you are dead set on using double tap you're going to have to rig up your OnClickListener() to store a timestamp and then check to see if the timestamp from the last click is close enough to the current one. If so you handle it as a double tap. It will get more complicated if you are having an action happen in the OnClick method already because you're going to have to use postDelayed() to delay that action until you know its not going to be a double click.


If you're trying with the LongClick, then instead of Fill Parent, try Match Parent. The other thing you can do is have every other element in a layout and hide that layout if that doesn't work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜