2013-05-01 3 views
0

это мой xml, поэтому теперь мне нужно создать EditText, нажав кнопку «Добавить», а затем новый EditText появится под предварительным просмотром одного из них, когда мне нужно будет вернуться это нажать кнопку Удалить и пропадут,Редактор editingxt, нажав кнопку «Добавить» и удалив, нажав кнопку «Удалить», присоединяющуюся к этому xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:padding="5dip" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 
    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Group Ping" 
     android:padding="5dp"/> 

    <EditText 
     android:id="@+id/edAddress" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="15dp" 
     android:hint="www.baidu.com"/> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="250dp" 
     android:orientation="horizontal" > 

     <Button 
     android:layout_weight="30" 
     android:id="@+id/btadd" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Add"/> 
    <Button 
     android:layout_weight="30" 
     android:id="@+id/btsub" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Delete"/> 
    <Button 
     android:layout_weight="30" 
     android:id="@+id/btgping" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Ping"/> 
    </LinearLayout> 
</LinearLayout> 
+0

использование видимости EditText – stackoverflow

ответ

0

показать использование и для скрытия использования шкуры

edittext.setvisibility(View.VISIBLE); 
edittext.setVisibility(View.GONE); 
+0

@Pragnani, спасибо – stackoverflow

+0

эх жаль, что не работает для меня, так есть еще один способ, но все равно спасибо – pAdu

2

Изначально в вашем XML-файле создать EditText и установить его следующий атрибут

android:visibility="invisible" 

и при нажатии кнопки выполните следующие программно

edittext.setVisibility(View.VISIBLE); 
Смежные вопросы