问题描述:

I am developing an android contacts based application.I have designed the views.I am in problem.When i click on plus button a edittext should appear in the same view

Can anyone help me

My java code is

package com.xib;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

public class FirstScreen extends Activity {

private Button Back;

public void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.first_screen);

Back = (Button)findViewById(R.id.back_btn1);

Back.setOnClickListener(new OnClickListener(){

@Override

public void onClick(View v)

{

Intent intent = new Intent(FirstScreen.this,SecondScreen.class);

startActivity(intent);

}

});

}

}

And my Xml is

<EditText

android:id="@+id/edit2"

android:hint=""

android:singleLine="true"

android:layout_marginLeft="50px"

android:layout_width="192px"

android:layout_height="wrap_content"/>

Thanks in advance

Tushar

网友答案:

I think his problem is adding dynamic view to his current activity means when the user clicks on plus button, may be he want to add dynamic edit text to his activity. For example in the android contacts while adding new contact there is a plus button whenever we click on that edittext will be added dynamically there so that we can add more contact numbers of a person like mobile, home etc.

相关阅读:
Top