Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

[Android] Android tab Fragment Expandable "View More"TextView

Good day everyone, i plan to create a text view hide "view more" on the announcement card view. But i had no idea how to coding it. Can someone give me some guidance? Thanks

TabFragmentAnnouncement.java :

package info.androidhive.navigationdrawer.fragment;



import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import info.androidhive.navigationdrawer.R;

/**
 * Created by hp1 on 21-01-2015.
 */
public class TabFragmentAnnouncement extends Fragment {


    TextView text;

    @Override
    public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstancesState){
        text = (TextView)getView().findViewById(R.id.tittleTextView);

    }

    public void onClick(View view){
        text = (TextView) view;
        text
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu)


    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v =inflater.inflate(R.layout.fragment_announcement_tab,container,false);

        return v;



    }
}

fragment_announcement_tab.xml :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_margin="5dp"

    >


    <android.support.v7.widget.CardView

        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        card_view:contentPadding="16dp"
        card_view:cardElevation="5dp"
        card_view:cardCornerRadius="5dp"
        android:background="@drawable/cardviewdesign"
        >

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >


            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_gravity="center"
                android:layout_height="match_parent">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="226dp">

                    <ImageView
                        android:id="@+id/coverImageView"
                        android:layout_width="match_parent"
                        android:layout_marginTop="10dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="top"
                        android:scaleType="centerCrop"
                        />

                    <LinearLayout
                        android:orientation="vertical"
                        android:layout_width="match_parent"
                        android:layout_gravity="left|bottom"
                        android:background="@android:drawable/screen_background_dark_transparent"
                        android:layout_height="60dp">


                        <TextView
                            android:text="TextView"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:id="@+id/tittleTextView"
                            android:padding="16dp"
                            android:textSize="@dimen/text_size"
                            android:textColor="#FFFFFF"
                            android:textStyle="bold"
                            />

                    </LinearLayout>

                </FrameLayout>

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="57dp">

                    <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="0"
                        android:gravity="right">

                        <ImageView
                            android:id="@+id/likeImageView"
                            android:layout_width="@dimen/icon_width"
                            android:layout_height="@dimen/icon_height"
                            android:padding="@dimen/icon_padding"
                            android:src="@drawable/ic_like"
                            android:paddingLeft="50dp"
                            android:layout_weight="0" />

                        <ImageView
                            android:id="@+id/shareImageView"
                            android:layout_width="@dimen/icon_width"
                            android:layout_height="@dimen/icon_height"
                            android:padding="@dimen/icon_padding"
                            android:src="@drawable/ic_share"
                            android:layout_weight="0"
                            />

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>

        </LinearLayout>


    </android.support.v7.widget.CardView>


</RelativeLayout>

My expected outcome is this

http://imgur.com/CtFTmtz