java - Android hide and show components -
i making sqlite android application list data , show graphs , visit web site starting default browser(not in application using webview) , send emails using form . have couple of forms . thinking instead of using several activities , xml layouts put in 1 xml layout , on button click show , hide components done javascript these components ...
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:layout_width="match_parent" android:layout_height="432dp" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:id="@+id/textview1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margintop="32dp" android:text="enter company name " /> <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/textview1" android:layout_centerhorizontal="true" android:ems="10"> <requestfocus /> </edittext> <spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/edittext1" android:layout_centerhorizontal="true" android:layout_margintop="17dp" android:entries="@array/country_arrays" android:prompt="@string/country_prompt" /> <spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/spinner1" android:layout_below="@+id/spinner1" android:entries="@array/limit_arrays" android:prompt="@string/limit_prompt" /> <button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/spinner2" android:layout_centerhorizontal="true" android:text="hide" /> <button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/button1" android:layout_centerhorizontal="true" android:text="show" /> </relativelayout> </scrollview>
then show or hide components using example
spinner1.setvisibility(view.visible); spinner1.setvisibility(view.gone);
this seams working fine , getting kind of low on space on xml screen. how put more components in bottom , make view scroll down although have put
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent">
on top of xml layout . , idea menu organisation ?
Comments
Post a Comment