Tweetview images truncated



Hi, I’m using tweetviews to display embedded tweets in our news articles. But the tweets which have images appear truncated.

Example screenshot:

Web url for this news :

I’m using tweetview to display this image. Code is as follows:

Xml for layout to display tweet.

<?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android=""

Adding tweet dynamically:

public static View getTweetViewForTweet(final Context context, final String element) {
        long id = Long.parseLong(getAtrribute(element, "id"));
        final ViewGroup mTweetView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.layout_tweet_view, null);
        TweetUtils.loadTweet(id, new Callback<Tweet>() {
            public void success(Result<Tweet> result) {
                final TweetView tweetView = new TweetView(context,,

            public void failure( e) {


        return mTweetView;

I’d appreciate some help. Thanks.


Currently the default aspect ratio for TweetViews is 3:2. Potentially you could override getAspectRatioForPhotoEntity to modify the aspect ratio.


Hi EricFrohnhoefer, Thanks for your advice. I tried overriding getAspectRatioForPhotoEntity and changed the aspect ratio to 0.5 which solved my problem. But it has certain side-effects on other tweets. In some tweets the image got stretched from the original one. The method has a check for adjusting ratio on basis of photocount, but in case of different tweets (each with a single photo and different sizes), this doesn’t work. Is there a way to check media entity size in any other callback so that I can adjust the aspect ratio on the basis of that?