I'm creating a custom Dialog that is started by a custom spinner. What I was trying to do is customize the dialog the spinner calls. However, there is an annoying space in the dialog. I've tryied all my resources to fix it, but nothing. I also followed this question's answer but didn't solve.
In the spinner xml file I pass it like this. It references the following class named CustomSpinner, that extends a Spinner:
<com.myproject.CustomSpinner
android:id="#+id/customSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="13dp"
android:prompt="#string/my_spinner"/>
And I have this class that is my custom dialog class:
public class CustomSpinnerDialog extends Dialog implements OnItemClickListener, View.OnClickListener
{
private OnItemSelectedListener onItemSelectedListener;
public DialogInterface.OnClickListener mListener;
public Context mContext;
public interface OnItemSelectedListener
{
public void onItemSelected(String itemValue);
}
public CustomSpinnerDialog(Context context, CustomSpinner.SpinnerAdapter spinnerAdapter, DialogInterface.OnClickListener listener)
{
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.custom_spinner);
mListener = listener;
mContext = context;
ListView listView = (ListView) this.findViewById(R.id.listview);
listView.setAdapter(spinnerAdapter);
listView.setOnItemClickListener(this);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
public void setOnItemSelectedListener(OnItemSelectedListener listener)
{
this.onItemSelectedListener = listener;
}
#Override
public void onClick(View v)
{
if(mListener != null)
mListener.onClick(this, DialogInterface.BUTTON_POSITIVE);
}
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
if(mListener != null)
mListener.onClick(this, position);
String text = (String) parent.getItemAtPosition(position);
onItemSelectedListener.onItemSelected(text);
}
public void setDialogTitle(String title)
{
TextView titleText = (TextView) this.findViewById(R.id.titleText);
titleText.setText(title);
}
}
And this is my custom spinner:
public class CustomSpinner extends Spinner implements DialogInterface.OnClickListener
{
public Context mContext;
public String[] mDataList;
public CustomSpinner(Context context, AttributeSet attrs)
{
super(context, attrs);
this.mContext = context;
}
#Override
public boolean performClick()
{
boolean handled = false;
if (!handled)
{
handled = true;
CustomSpinnerDialog dialog = new CustomSpinnerDialog(mContext, (ListAdapter) getAdapter(), this, R.style.FullHeightDialog);
dialog.setDialogTitle(mContext.getResources().getString((R.string.my_dialog_text)));
dialog.show();
}
return handled;
}
#Override
public void onClick(DialogInterface dialog, int which)
{
setSelection(which);
dialog.dismiss();
}
}
My Spinner is created like this in an Activity:
cSpinner= (CustomSpinner) findViewById(R.id.customSpinner);
cSpinner.setDataList(dataList);
cSpinner.setTag("CustomSpinner");
cSpinner.setOnItemSelectedListener(controller);
Here is a screenshot of how the dialog looks like:
diaPhoto = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
I solved it following the documentation
And based in this code as advised by the documentation link above:
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
(ViewGroup) findViewById(R.id.layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();
Related
I'm making a list view using a custom adapter.
In that, I want show a dialog when each item is clicked (surely, a different dialog at each list).
Here is my code.
MainActivity:
public class MainActivity extends AppCompatActivity {
ListView listView;
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ArrayList<MyCustomList> list = new ArrayList<MyCustomList>();
list.add(new MyCustomList("a", R.string.jangho_string1, R.string.jangho_string2, R.drawable.jangho));
list.add(new MyCustomList("b", R.string.dae_string1, R.string.dae_string2, R.drawable.dae));
list.add(new MyCustomList("c", R.string.an_string1, R.string.an_string2, R.drawable.an));
listView = (ListView)findViewById(R.id.listviewone);
MyCustomAdapter adapter = new MyCustomAdapter(getApplicationContext(), R.layout.listviewone, list);
listView.setAdapter(adapter);
}
}
MyCustomAdapter
public class MyCustomAdapter extends BaseAdapter {
Context ctx;
int layout;
ArrayList<MyCustomList> list;
LayoutInflater inf;
public MyCustomAdapter(Context ctx, int layout, ArrayList<MyCustomList> list){
this.ctx = ctx;
this.layout = layout;
this.list = list;
inf = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public View getView(final int position, View convertView, ViewGroup parent){
if(convertView == null){
convertView = inf.inflate(layout, null);
}
final View.OnClickListener makeListener = new View.OnClickListener() {
#Override
public void onClick(View v) {
((Activity)ctx).showDialog(position);
}
};
convertView.setOnClickListener(makeListener);
return convertView;
}
protected Dialog onCreateDialog(int position){
Dialog dialog = null;
switch (position){
case 0:
break;
}
return dialog;
}
}
I'm using Android Studio.
you can create a method to show dialog, and pass the values from the listItem which is clicked
public void showDialog(Context context, String something){
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dialog_layout);
//Initialize your widgets from layout here
dialog.show();
//You can dialog.dismiss() to close the dialog.
}
Firstly,use ViewHolder when using listview. And just use listview.setOnItemClickListener
try this to create Custom Dialog
final Dialog dialog = new Dialog(MainActivity.this);
// Include dialog.xml file
dialog.setContentView(R.layout.forgotpassword);
// Set dialog title
dialog.setTitle("ALERT!!");
// set values for custom dialog components - text, image and button
Button okbtn = (Button) dialog.findViewById(R.id.okbtn);
Button cancelbtn = (Button) dialog.findViewById(R.id.cancelbtn);
final EditText emailedittext = (EditText) dialog.findViewById(R.id.emailedittext);
dialog.show();
dialog.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
// if decline button is clicked, close the custom dialog
cancelbtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// Close dialog
dialog.dismiss();
}
});
okbtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String email=emailedittext.getText().toString();
//do something more here
}
});
Refer here:- http://coderzpassion.com/android-show-alertdialog/
public class SoloPlayActivity extends BaseActivity implements View.OnClickListener{
private ListView case_list;
private RelativeLayout add_case;
private TextView num_case_textview;
private Button start_button;
ArrayList<ItemSoloplayCase> caseArrayList;
AdapterSoloplay adapter;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solo_play);
initView();
//처음에는 경우의 수가 아무것도 없음
num_case_textview.setText("0");
caseArrayList = new ArrayList<ItemSoloplayCase>();
adapter = new AdapterSoloplay(this, caseArrayList, num_case_textview);
case_list.setAdapter(adapter);
}
private void initView(){
add_case = (RelativeLayout)findViewById(R.id.add_case);
add_case.setOnClickListener(this);
num_case_textview = (TextView)findViewById(R.id.num_case);
start_button = (Button)findViewById(R.id.game_start);
start_button.setOnClickListener(this);
case_list = (ListView)findViewById(R.id.case_list);
//리스트뷰에서 포커스를 잃지 않도록 한다.
case_list.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
}
#Override
protected String getActionbarTitle() {
return getString(R.string.solo_play_name);
}
//뒤로가기가 눌렸을때 추가한 경우의 수가 있을경우에만 다이얼로그 띄우고 경우의수가 비었다면 그냥 종료
#Override
public void onBackPressed() {
if (!caseArrayList.isEmpty()) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("입력한 경우의 수는 모두 사라집니다. 정말로 닫겠습니까?")
.setCancelable(false)
.setPositiveButton("확인", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
SoloPlayActivity.this.finish();
}
})
.setNegativeButton("취소", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
else
SoloPlayActivity.this.finish();
}
#Override
public void onClick(View v) {
switch (v.getId()){
case R.id.game_start:
Toast.makeText(getApplicationContext(), "게임시작 버튼 누름", Toast.LENGTH_SHORT);
break;
case R.id.add_case:
//경우의수 추가
ItemSoloplayCase additem = new ItemSoloplayCase();
caseArrayList.add(additem);
num_case_textview.setText(Integer.toString(caseArrayList.size()));
adapter.notifyDataSetChanged();
break;
}
}}
activity file.
Adapter file.
public class AdapterSoloplay extends BaseAdapter {
private Context context;
private ArrayList<ItemSoloplayCase> caselist;
private TextView num_case;
//순서 갱신 오류, 해당 지운 에디트가 지워지지 않음
public AdapterSoloplay(Context context, ArrayList<ItemSoloplayCase> caselist, TextView num_case) {
this.context = context;
this.caselist = caselist;
this.num_case = num_case;
}
#Override
public int getCount() {
return caselist.size();
}
#Override
public Object getItem(int position) {
return caselist.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
final Viewholder holder;
if (convertView == null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.item_case_input, parent, false);
holder = new Viewholder();
holder.order = (TextView) convertView.findViewById(R.id.order_num);
holder.editText = (EditText)convertView.findViewById(R.id.input_case);
holder.button_clear = (ImageButton)convertView.findViewById(R.id.remove_case);
//순서는 현재 크기만큼
holder.order.setText(Integer.toString(getCount()));
convertView.setTag(holder);
}
else
holder = (Viewholder)convertView.getTag();
//클리어를 눌럿을때 제거하고 순서를 재정렬하고 갱신시킨다
holder.button_clear.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
ItemSoloplayCase item = (ItemSoloplayCase)getItem(position);
item = null;
caselist.remove(position);
notifyDataSetChanged();
num_case.setText(Integer.toString(caselist.size()));
}
});
return convertView;
}
class Viewholder {
private EditText editText;
private TextView order;
private ImageButton button_clear;
}
}
i want to make dynamically add or remove edit text in list view. '
like image.
enter image description here
if i want remove second list(in this image, b) but it removed last data(in this image, d). and i click add button it makes last data..(in this image, makes edit text value d).
above is my code. help.
please help me.
Add a linearlayout to listview rows xml file :
For add dynamically EditText to this layout try this :
EditText editText = new EditText(context);
editText.setHint(hint);
editText.requestFocus();
editText.setSelection(editText.getText().length());
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
linearlayout.addview(editText);
here is my code for ArrayAdapter. When i click on LinearLayout "cat" it gives error on dialog.show(). I don't know how to create custom dialog within ArrayAdapter class.
Everything work fine when i remove creating dialog part.
Thanks in advance
CategoryAdapter.java
public class CategoryAdapter extends ArrayAdapter<String> {
private final Context context;
String[] menu = new String[25] ;
String[] menu2 = new String[25];
String[] menu3 = new String[25];
private LayoutInflater inflater;
viewholder vh;
public CategoryAdapter(Context context, String [] menu,String [] menu2,String [] menu3) {
super(context, R.layout.categoryadapter, menu);
this.context = context;
this.menu = menu;
this.menu2=menu2;
this.menu3=menu3;
}
public View getView(final int position, View convertView, ViewGroup parent) {
{
vh=new viewholder();
if (inflater == null)
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.categoryadapter, parent, false);
vh.cat=(LinearLayout) convertView.findViewById(R.id.category);
convertView.setTag(vh);
}
vh.cat.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.update_categore_dialog);
dialog.setTitle("Update Your Category");
dialog.show();
Toast.makeText(getContext(), "Clicked", Toast.LENGTH_LONG).show();
}
});
return convertView;
}
public class viewholder
{
LinearLayout cat;
}
}
Use context instead getContext()
final Dialog dialog = new Dialog(context);
Finally, Just pass context
vh.cat.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.update_categore_dialog);
dialog.setTitle("Update Your Category");
dialog.show();
Toast.makeText(getContext(), "Clicked", Toast.LENGTH_LONG).show();
}
});
Try-
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.update_categore_dialog);
dialog.setTitle("Update Your Category");
dialog.show();
try this below link, hope you like it.
OrderDetailListAdatper adapter = new OrderDetailListAdatper(Yourclass.this,Resource,
listorderlistInfo);
//set your adapter..
in your adapter getview, paste that code and it works fine for me.
holder.btnDelete.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
AlertDialog.Builder alert = new AlertDialog.Builder((Activity)_context);
alert.setMessage("Do you want to delete?");
alert.setNegativeButton("CANCEL",
new DialogInterface.OnClickListener() {
#Override
public void onClick(
DialogInterface dialog,
int whichButton) {
dialog.cancel();
}
});
alert.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
#Override
public void onClick(
DialogInterface dialog,
int whichButton) {
OrderDetailListAdatper.this._listOrderListInfoAdapter
.remove(position); OrderDetailListAdatper.thisnotifyDataSetChanged();
}
});
alert.create().show(); // btw show() creates and shows it..
}
});
In your getView() method, Replace getContext() with your context variable.
vh.cat.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
final Dialog dialog = new Dialog(context);
//remaining code...
}
});
And in your initialization of CateogoryAdapter don't pass getApplicationContext(), instead pass in the context (Activity.this) like this.
CategoryAdapter adapter = CategoryAdapter(YourActivity.this, menu, menu2, menu3)
I have a custom dialog created inside an Adapter, which has two buttons ((+)ve and (-)ve), (+)ve vl call another service and (-)ve will simply dismiss the dialog.
public class BookingAdapter extends ArrayAdapter<BookingItem> {
private Dialog aDialog;
private Context context;
private Activity activity;
public BookingAdapter (Context context, int resource, List<BookingItem> objects) {
super(context, resource, objects);
this.context = context;
this.activity = (Activity) context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// some other tasks being done
onButtonClick(position, holder);
return convertView;
}
public void onButtonClick(final int position, ViewHolder viewHolder){
// some other tasks being done
makeDialog(name, id, date, cost);
}
public void makeDialog(final String name, final String Id, final String date, String cost){
Button confirmButton;
Button cancelAndReturnButton;
TextView confirmDialogBody;
aDialog = new Dialog(activity, R.style.Dialog_No_Border);
aDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
LayoutInflater m_inflater = LayoutInflater.from(activity);
View m_view = m_inflater.inflate(R.layout.casual_day_booking_confirm_dialog, null);
// set Buttons and Texts
View.OnClickListener m_clickListener = new View.OnClickListener(){
#Override
public void onClick(View p_v) {
switch (p_v.getId()) {
case R.id.confirm_and_proceed:
PlaceBookingTask bookingTask = new PlaceBookingTask(date,Id,context);
bookingTask.execute();
break;
case R.id.cancel_and_return:
aDialog.dismiss();
break;
default:
break;
}
}
};
aDialog.setContentView(m_view);
if(!activity.isFinishing()) {
aDialog.show();
}
}
#Subscribe
public void onSuccess(PlaceBookingEvent event){
PlaceBookingResponse response = event.getPlaceBookingResponse();
aDialog.dismiss();
secondConfirmationDialog(response.getName, response.getDate, response.getId);
}
public void secondConfirmationDialog(String name,String date,String id) {
// this will create another dialog
}
}
When onSuccess, aDialog.dismiss(), aDialog is null and cannot be dismissed.
i checked some similar questions in SO like this and this, i'm doubt that only AlertDialog.Builder is the solution for my problem.
Try removing the "private" in your variable.
I think your dialog implementation is wrong. Try with the following.
// custom dialog
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);
dialog.setTitle("Title...");
// set the custom dialog components - text, image and button
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Android custom dialog example!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.ic_launcher);
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
I'm creating a custom Spinner that shows a custom Dialog. For that, I created a class called CustomSpinner and another called CustomSpinnerDialog.
The problem is that, in the Spinner, the selected value in the Dialog is not printed. I know that the value is correctly being returned, I've checked it with LogCat and Debug.
And in my custom dialog, I've created an interface for onItemSelectedListener, so my CustomSpinner class implements this interface. The code is below.
In the spinner xml file I pass it like this. It references the following class named CustomSpinner, that extends a Spinner:
<com.myproject.CustomSpinner
android:id="#+id/customSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="13dp"
android:prompt="#string/my_spinner"/>
Here is the CustomSpinner.java class:
public class CustomSpinner extends Spinner implements DialogInterface.OnClickListener, CustomSpinnerDialog.OnItemSelectedListener
{
public OnAddListener mListener = null;
public Context mContext;
public String[] mDataList;
public SpinnerAdapter mAdapter = null;
public interface OnAddListener
{
void onAdd(Spinner inSpinner);
}
public CustomSpinner(Context context, String[] dataList)
{
super(context);
this.mContext = context;
this.mDataList = dataList;
}
public CustomSpinner(Context context, AttributeSet attrs)
{
super(context, attrs);
this.mContext = context;
}
public void setDataList(String[] dataList)
{
this.mDataList = dataList;
}
#Override
public boolean performClick()
{
boolean handled = false;
if (!handled)
{
handled = true;
mAdapter = new SpinnerAdapter(mContext, R.id.spinnerItemText, mDataList);
CustomSpinnerDialog dialog = new CustomSpinnerDialog(mContext, mAdapter, this);
dialog.setOnItemSelectedListener(this);
dialog.setDialogTitle("My custom Dialog");
dialog.show();
}
return handled;
}
#Override
public void onClick(DialogInterface dialog, int which)
{
if(which == DialogInterface.BUTTON_POSITIVE)
{
if(mListener!=null)
mListener.onAdd(this);
}
else
{
setSelection(which);
}
dialog.dismiss();
}
public class SpinnerAdapter extends ArrayAdapter<String>
{
public Context mContext;
public SpinnerAdapter(Context context, int textViewResourceId, String[] objects)
{
super(context, textViewResourceId, objects);
this.mContext = context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.spinnerdialogitem, null);
TextView item = (TextView) view.findViewById(R.id.spinnerItemText);
String text = mDataList[position];
item.setText(text);
return view;
}
}
#Override
public void onItemSelected(String itemValue)
{
int position = mAdapter.getPosition(itemValue);
this.setSelection(3);
}
}
And here is the CustomSpinnerDialog.java class:
public class CustomSpinnerDialog extends Dialog implements OnItemClickListener, View.OnClickListener
{
private OnItemSelectedListener onItemSelectedListener;
public DialogInterface.OnClickListener mListener;
public Context mContext;
public interface OnItemSelectedListener
{
public void onItemSelected(String itemValue);
}
public CustomSpinnerDialog(Context context, CustomSpinner.SpinnerAdapter spinnerAdapter, DialogInterface.OnClickListener listener)
{
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.custom_spinner);
mListener = listener;
mContext = context;
ListView listView = (ListView) this.findViewById(R.id.listview);
listView.setAdapter(spinnerAdapter);
listView.setOnItemClickListener(this);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
public void setOnItemSelectedListener(OnItemSelectedListener listener)
{
this.onItemSelectedListener = listener;
}
#Override
public void onClick(View v)
{
if(mListener != null)
mListener.onClick(this, DialogInterface.BUTTON_POSITIVE);
}
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
if(mListener != null)
mListener.onClick(this, position);
String text = (String) parent.getItemAtPosition(position);
onItemSelectedListener.onItemSelected(text);
}
public void setDialogTitle(String title)
{
TextView titleText = (TextView) this.findViewById(R.id.titleText);
titleText.setText(title);
}
}
Well, the Spinner is started in an Activity like this:
cSpinner= (CustomSpinner) findViewById(R.id.customSpinner);
cSpinner.setDataList(dataList);
cSpinner.setTag("CustomSpinner");
cSpinner.setOnItemSelectedListener(controller);
What I tried that didnt solve:
In the method onItemSelected(String itemValue) in the class CustomSpinner, I've tried:
this.setPrompt(itemValue); // Didnt solve
int position = mAdapter.getPosition(itemValue);//Didnt solve
this.setSelection(itemValue);
And I know that this value is being correctly returned.
Thanks in advance.
I simply removed the adapter class declared in CustomSpinner class, also removed this constructor:
public CustomSpinner(Context context, String[] dataList)
{
super(context);
this.mContext = context;
this.mDataList = dataList;
}
And instead of creating the spinner like this:
cSpinner= (CustomSpinner) findViewById(R.id.customSpinner);
cSpinner.setDataList(dataList);
cSpinner.setTag("CustomSpinner");
cSpinner.setOnItemSelectedListener(controller);
I created it like this:
cSpinner = (CustomSpinner)findViewById(R.id.customSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.options_array, R.layout.spinner_target);
cSpinner .setAdapter(adapter);
cSpinner .setTag("CustomSpinner");
cSpinner .setOnItemSelectedListener(controller);
And the spinner_target.xml passed as the last parameter to the createFromResource() method is a simple xml file that has only a TextView:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/spinnerTarget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:padding="8dp"/>