I want to convert TextView into Edit Text and vice versa in a button click event in android. I don't know how to achieve this , please help if anyone knows the solution.
Regards, Rajapandian.K
Put your EditText and TextView into FrameLayout or RelativeLayout and just do setVisibility() on them hidding one and showing another when needed. Show activity on this post. And change visibility of EditText or TextView from code, whenever you want. Note: for default TextView invisible.
setTextColor() with the first color of the gradient. Then the screenshot: What works is to have, for instance, a white color setup as text color in the first place. Then we can apply the shader, and it will be applied on top of the white so we will get the desired gradient color.
Best to use a ViewSwitcher
... <ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_switcher" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/clickable_text_view" android:clickable="true" android:onClick="TextViewClicked" android:text="@string/some_value" /> <EditText android:id="@+id/hidden_edit_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/some_value" /> </ViewSwitcher> ...
Then you can switch the views by
public void TextViewClicked() { ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.my_switcher); switcher.showNext(); //or switcher.showPrevious(); TextView myTV = (TextView) switcher.findViewById(R.id.clickable_text_view); myTV.setText("value"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With