make a row in table layout invisibible and later visible .

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

make a row in table layout invisibible and later visible .

Postby neeraj_maverick » Sat Jan 09, 2010 10:07 pm

Suppose we want to make a row invisible @ start of application and later visible on some action.

looking @ xml file below i want to make entire row invisible and in that row i have two textview elements Final and finalcalculate..lets assume that it is row number 7 in the UI layout file.
<TableRow
android:id="@+id/Final"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="invisible"


>
<TextView
android:id="@+id/finalcalculate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Final Carbon content"
android:layout_column="0"
android:layout_span="2"
android:textColor="#ff990000"
>
</TextView>


<TextView
android:id="@+id/finalvalue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:text="90 units"
android:layout_column="2"
android:textColor="#ff990000"
>
</TextView>

now on a event:I identify the row(row 7 in this case) and then make it visible..

few parameters to fetch them are

TableRow visiblee;// to identify the row
TableLayout tl;//to identify the table layout in the UI file

here i assign the visiblee parameter
visiblee=new TableRow(getApplicationContext());
visiblee=(TableRow)tl.getChildAt(7);//here 7 is the particular row
visiblee.setVisibility(0);//setting to 0 makes it visible
upon this row 7 is visible now..
similairly visibility can be set @ textview level also..




</TableRow>
neeraj_maverick
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Jan 09, 2010 9:23 pm
Location: India

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests