Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
width of my TextureView
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bob  
View profile  
 More options Oct 2 2012, 2:07 pm
From: bob <b...@coolfone.comze.com>
Date: Tue, 2 Oct 2012 11:07:06 -0700 (PDT)
Local: Tues, Oct 2 2012 2:07 pm
Subject: width of my TextureView

Can someone help me see how to figure out the width of my TextureView?

I tried this, but I got zeros (in the_width and the_height):

*protected void onCreate(Bundle savedInstanceState) {*
*
*
*mTextureView = new TextureView(this);*
*
*
*setContentView(mTextureView);*
*
*
*int the_width = mTextureView.getWidth();*
*int the_height = mTextureView.getHeight();*


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TreKing  
View profile  
 More options Oct 2 2012, 5:17 pm
From: TreKing <treking...@gmail.com>
Date: Tue, 2 Oct 2012 16:12:02 -0500
Local: Tues, Oct 2 2012 5:12 pm
Subject: Re: [android-developers] width of my TextureView

On Tue, Oct 2, 2012 at 1:07 PM, bob <b...@coolfone.comze.com> wrote:
> Can someone help me see how to figure out the width of my TextureView?

This has come up before. Search this group for those two methods, I'm sure
you'll find something useful.

--------------------------------------------------------------------------- ----------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Piren  
View profile  
 More options Oct 3 2012, 7:50 am
From: Piren <gpi...@gmail.com>
Date: Wed, 3 Oct 2012 04:50:15 -0700 (PDT)
Local: Wed, Oct 3 2012 7:50 am
Subject: Re: width of my TextureView

At the point you're querying for the width/height the layout hasn't really
been laid (those are not done right after creation of a view), you've never
really specified for that view any layout parameters (why are you not using
an xml layout anyhow?) and you didnt define any content for it, so what
exactly is supposed to be measured?

Assuming you do all of that and when running the app the TextureView is
showing properly as you want it to show, then you can figure out the width.
The best method i've find is using a GlobalLayoutListener

 ViewTreeObserver vto = mTextureView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener(){
@Override
public void onGlobalLayout(){
                                 //at this point you'll know its height and
width, so use them here
ViewTreeObserver obs =   mTextureView .getViewTreeObserver();
obs.removeGlobalOnLayoutListener(this); //so it wouldn't be called again


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »