• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps ANDROID LISTVIEW WITH ALERTDIALOG

mesfun

Lurker
Code:
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class MainActivity extends Activity
{
    TextView red;
    StringBuilder sb;
    MyCustomAdapter dataAdapter = null;

    [USER=1021285]@override[/USER]
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Generate list View from ArrayList
        displayListView();

        checkButtonClick();

    }

    private void displayListView()
    {

        //Array list of countries
        ArrayList<States> stateList = new ArrayList<States>();

        States _states = new States("GA","Atlanta",false);
        stateList.add(_states);
        _states = new States("MA","Boston",false);
        stateList.add(_states);
        _states = new States("OK","Oklahoma",false);
        stateList.add(_states);
        _states = new States("SC","Columbia",false);
        stateList.add(_states);
        _states = new States("TX","Texas",false);
        stateList.add(_states);
        _states = new States("TN","Nashville",false);
        stateList.add(_states);
        _states = new States("AR","Little rock",false);
        stateList.add(_states);
        _states = new States("HI","Honolulu",false);
        stateList.add(_states);

        //create an ArrayAdaptar from the String Array
        dataAdapter = new MyCustomAdapter(this,R.layout.customlist, stateList);
        ListView listView = (ListView) findViewById(R.id.listView1);
        // Assign adapter to ListView
        listView.setAdapter(dataAdapter);

        listView.setOnItemClickListener(new OnItemClickListener()
        {

            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                // When clicked, show a toast with the TextView text
                States state = (States) parent.getItemAtPosition(position);
                Toast.makeText(getApplicationContext(),"Clicked on Row: " + state.getName(),
                        Toast.LENGTH_LONG).show();
            }
        });
    }

    private class MyCustomAdapter extends ArrayAdapter<States>
    {

        private ArrayList<States> stateList;

        public MyCustomAdapter(Context context, int textViewResourceId,

                               ArrayList<States> stateList)
        {
            super(context, textViewResourceId, stateList);
            this.stateList = new ArrayList<States>();
            this.stateList.addAll(stateList);
        }

        private class ViewHolder
        {
            TextView code;
            TextView red;
            CheckBox name;
        }

        [USER=1021285]@override[/USER]
        public View getView(int position, View convertView, ViewGroup parent)
        {

            ViewHolder holder = null;

            Log.v("ConvertView", String.valueOf(position));

            if (convertView == null)
            {

                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                convertView = vi.inflate(R.layout.customlist, null);

                holder = new ViewHolder();
                holder.code = (TextView) convertView.findViewById(R.id.code);
                holder.name = (CheckBox) convertView.findViewById(R.id.checkBox1);
                holder.red = (TextView) convertView.findViewById(R.id.flower);
                convertView.setTag(holder);


                final ViewHolder finalHolder = holder;
                holder.name.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        if (isChecked) {

                            final CharSequence[] dilogList = {"Red", "Yellow", "Green","Purple", "Brown"};

                            AlertDialog.Builder multChoiceDialog = new AlertDialog.Builder(MainActivity.this);




                            multChoiceDialog.setTitle("Flower grow in this states");

                            boolean[] _selections = new boolean[dilogList.length];

                            multChoiceDialog.setMultiChoiceItems(dilogList, _selections, new DialogInterface.OnMultiChoiceClickListener() {
                                public void onClick(DialogInterface dialog,
                                                    int whichButton, boolean isChecked) {
                                }
                            });


                            multChoiceDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                                [USER=1021285]@override[/USER]
                                public void onClick(DialogInterface dialog, int which) {
                                    // getting listview from alert box
                                    ListView list = ((AlertDialog) dialog).getListView();
                                    StringBuilder sb = new StringBuilder();
                                    for (int i = 0; i < list.getCount(); i++) {
                                        boolean checked = list.isItemChecked(i);
                                        // get checked list value
                                        if (checked) {
                                            if (sb.length() > 0)
                                                sb.append(",");
                                            sb.append(list.getItemAtPosition(i));
                                        }
                                    }

                                    Toast.makeText(getApplicationContext(), "Selected city:"
                                            + sb.toString(), Toast.LENGTH_SHORT).show();
                                    finalHolder.red.setText(sb);
                                }
                            });


                            multChoiceDialog.setNegativeButton("Cancel",
                                    new DialogInterface.OnClickListener() {
                                        [USER=1021285]@override[/USER]
                                        public void onClick(DialogInterface dialog, int which) {
                                            // cancel code here
                                        }
                                    });
                            AlertDialog alert1 = multChoiceDialog.create();
                            alert1.show();

                        } else {

                            finalHolder.red.setText("");

                        }

                    }
                });

                holder.name.setOnClickListener( new View.OnClickListener()
                {
                    public void onClick(View v)
                    {
                        CheckBox cb = (CheckBox) v;
                        States _state = (States) cb.getTag();
                        _state.setSelected(cb.isChecked());
                    }
                });

            }
            else
            {
                holder = (ViewHolder) convertView.getTag();
            }

            States state = stateList.get(position);

            holder.code.setText(" (" + state.getCode() + ")");
            holder.name.setText(state.getName());
            holder.name.setChecked(state.isSelected());
            holder.name.setTag(state);

            return convertView;
        }

    }
    private void checkButtonClick()
    {

        Button myButton = (Button) findViewById(R.id.findSelected);


        myButton.setOnClickListener(new OnClickListener()
        {

            [USER=1021285]@override[/USER]
            public void onClick(View v)
            {
                StringBuffer responseText = new StringBuffer();
                responseText.append("The following were selected...\n");

                ArrayList<States> stateList = dataAdapter.stateList;

                for(int i=0;i<stateList.size();i++)
                {
                    States state = stateList.get(i);

                    if(state.isSelected())
                    {
                        responseText.append("\n" + state.getName());
                    }
                }

                Toast.makeText(getApplicationContext(),
                        responseText, Toast.LENGTH_LONG).show();
            }
        });
    }

}


MY ADAPTER IS

Code:
public class States
{

    String code = null;
    String name = null;
    boolean selected = false;

    public States(String code, String name, boolean selected)
    {
        super();
        this.code = code;
        this.name = name;
        this.selected = selected;
    }



    public String getCode()
    {
        return code;
    }

    public void setCode(String code)
    {
        this.code = code;
    }
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public boolean isSelected()
    {
        return selected;
    }

    public void setSelected(boolean selected)
    {
        this.selected = selected;
    }

}


MAIN XML

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:eek:rientation="vertical"
    android:gravity="center"
    android:background="#ffeeeeee">

    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:padding="10dp"
        android:text="USA" android:textSize="20sp" />

    <Button android:id="@+id/findSelected"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="USA States Grow Flower" />

    <ListView android:id="@+id/listView1" android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

CUSTOM XML
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:eek:rientation="vertical"
    android:padding="6dip">

    <CheckBox android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:focusable="false"
        android:textColor="#ff00bb88"
        android:focusableInTouchMode="false"
        android:text="checkbox" />

    <TextView android:id="@+id/code"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@id/checkBox1"
        android:layout_alignBottom="@id/checkBox1"
        android:layout_toRightOf="@id/checkBox1"
        android:text="textview"
        android:textColor="#ff000000"/>


    <TextView android:id="@+id/flower"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#ff000000"
        android:singleLine="true"
        android:layout_alignTop="@+id/code"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />


</RelativeLayout>


MY QUESTION IS HOW TO SEE WHEN I CLIK A BUTTON
ATLANTA RED,YELLOW
BOSTON YELLOW,BROWN
AND SO ON
HOW I DO THAT
 
Last edited by a moderator:
It's not clear what your problem is, or what you're trying to achieve.
If you would like to re-phrase the question, someone is more likely to be able to help you.
Thanks.
 
Listview inside alertdialog issue

what i want is when you select Atlanta show a dialog box and choose red yellow and the same choose Texas and dialog choose yellow Brown
click a button USA states Grow Flower and show only The following were selected Atlanta Texas but i want when i click a button to show me
The following were selected Atlanta red,yellow Texas yellow,Brown
 
I really appreciate your response Today i try different ways to show me when i click a button usa states grow Flower
i get some improvement that shows each row shows the same dialog multi check result how i do that different row result of each row result but so far show me the same result all rows .please try what i make to work it is below my code i need a little help, Thanks your time.

Code:
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class MainActivity extends Activity
{
    String yellow;
    TextView red;
    StringBuilder sb;
    MyCustomAdapter dataAdapter = null;

    [USER=1021285]@override[/USER]
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Generate list View from ArrayList
        displayListView();

        checkButtonClick();

    }

    private void displayListView()
    {

        //Array list of countries
        ArrayList<States> stateList = new ArrayList<States>();
        States _states = new States("GA","Atlanta",false);
        stateList.add(_states);
        _states = new States("MA","Boston", false);
        stateList.add(_states);
        _states = new States("OK","Oklahoma", false);
        stateList.add(_states);
        _states = new States("SC","Columbia", false);
        stateList.add(_states);
        _states = new States("TX","Texas", false);
        stateList.add(_states);
        _states = new States("TN","Nashville", false);
        stateList.add(_states);
        _states = new States("AR","Little rock", false);
        stateList.add(_states);
        _states = new States("HI","Honolulu", false);
        stateList.add(_states);

        //create an ArrayAdaptar from the String Array
        dataAdapter = new MyCustomAdapter(this,R.layout.customlist, stateList);
        ListView listView = (ListView) findViewById(R.id.listView1);
        // Assign adapter to ListView
        listView.setAdapter(dataAdapter);

        listView.setOnItemClickListener(new OnItemClickListener()
        {

            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                States state = (States) parent.getItemAtPosition(position);
                Toast.makeText(getApplicationContext(),"Clicked on Row: " + state.getName(),
                        Toast.LENGTH_LONG).show();
            }
        });
    }

    private class MyCustomAdapter extends ArrayAdapter<States>
    {
        private ArrayList<States> stateList;

        public MyCustomAdapter(Context context, int textViewResourceId,

                               ArrayList<States> stateList)
        {
            super(context, textViewResourceId, stateList);
            this.stateList = new ArrayList<States>();
            this.stateList.addAll(stateList);
        }

        private class ViewHolder
        {
            TextView code;
            CheckBox name;
        }
        [USER=1021285]@override[/USER]
        public View getView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder = null;
            Log.v("ConvertView", String.valueOf(position));

            if (convertView == null)
            {

                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = vi.inflate(R.layout.customlist, null);
                holder = new ViewHolder();
                holder.code = (TextView) convertView.findViewById(R.id.code);
                holder.name = (CheckBox) convertView.findViewById(R.id.checkBox1);
                red = (TextView) convertView.findViewById(R.id.flower);
                convertView.setTag(holder);

                final ViewHolder finalHolder = holder;
                holder.name.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        if (isChecked) {
                            final CharSequence[] dilogList = {"Red", "Yellow", "Green","Purple", "Brown"};
                            AlertDialog.Builder multChoiceDialog = new AlertDialog.Builder(MainActivity.this);
                            multChoiceDialog.setTitle("Flower grow in this states");

                            boolean[] _selections = new boolean[dilogList.length];

                            multChoiceDialog.setMultiChoiceItems(dilogList, _selections, new DialogInterface.OnMultiChoiceClickListener() {
                                public void onClick(DialogInterface dialog,
                                                    int whichButton, boolean isChecked) {
                                }
                            });


                            multChoiceDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                                [USER=1021285]@override[/USER]
                                public void onClick(DialogInterface dialog, int which) {
                                    // getting listview from alert box
                                    ListView list = ((AlertDialog) dialog).getListView();
                                    StringBuilder sb = new StringBuilder();
                                    for (int i = 0; i < list.getCount(); i++) {
                                        boolean checked = list.isItemChecked(i);
                                        // get checked list value
                                        if (checked) {
                                            if (sb.length() > 0)
                                                sb.append(",");
                                            sb.append(list.getItemAtPosition(i));
                                        }
                                    }


                                 red.setText(sb);
                                }
                            });


                            multChoiceDialog.setNegativeButton("Cancel",
                                    new DialogInterface.OnClickListener() {
                                        [USER=1021285]@override[/USER]
                                        public void onClick(DialogInterface dialog, int which) {
                                            // cancel code here
                                        }
                                    });
                            AlertDialog alert1 = multChoiceDialog.create();
                            alert1.show();

                        } else {

                            red.setText("");

                        }

                    }
                });

                holder.name.setOnClickListener( new View.OnClickListener()
                {
                    public void onClick(View v)
                    {
                        CheckBox cb = (CheckBox) v;
                        States _state = (States) cb.getTag();
                        _state.setSelected(cb.isChecked());
                    }
                });

            }
            else
            {
                holder = (ViewHolder) convertView.getTag();
            }
            States state = stateList.get(position);
            holder.code.setText(" (" + state.getCode() + ")");
            holder.name.setText(state.getName());
            holder.name.setChecked(state.isSelected());
            holder.name.setTag(state);

            return convertView;
        }

    }
    private void checkButtonClick()
    {

        Button myButton = (Button) findViewById(R.id.findSelected);
        myButton.setOnClickListener(new OnClickListener()
        {

            [USER=1021285]@override[/USER]
            public void onClick(View v)
            {
                StringBuffer responseText = new StringBuffer();
                responseText.append("The following were selected...\n");
                ArrayList<States> stateList = dataAdapter.stateList;
                yellow= (String) red.getText();
                for(int i=0;i<stateList.size(); i++)
                {
                    States state = stateList.get(i);
                    if(state.isSelected())
                    {
                        responseText.append("\n" + state.getName()+"  "+ yellow );
                    }
                }

                Toast.makeText(getApplicationContext(),
                        responseText, Toast.LENGTH_LONG).show();
            }
        });
    }

}
 
Last edited by a moderator:
I appreciate that English is probably not your first language, but I'm sorry I really can't understand what you're trying to say. Maybe you could attach a screenshot to explain what the problem is?
 
Thanks your help this is my picture shot. when i click order i want to see different


upload_2017-5-17_21-23-14.png



main activity

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class MainActivity extends Activity
{
String yellow;
TextView red;
StringBuilder sb;
MyCustomAdapter dataAdapter = null;

@override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//Generate list View from ArrayList
displayListView();

checkButtonClick();

}

private void displayListView()
{

//Array list of countries
ArrayList<States> stateList = new ArrayList<States>();
States _states = new States("HUMBURGER BEEF",false);
stateList.add(_states);
_states = new States("CHICKEN BURGER", false);
stateList.add(_states);
_states = new States("STEAK & CHEESE", false);
stateList.add(_states);
_states = new States("TUNA ", false);
stateList.add(_states);
_states = new States("COLD CUT COMBO", false);
stateList.add(_states);
_states = new States("TURKEY BREAST", false);
stateList.add(_states);
_states = new States("SUBWAY CLUB", false);
stateList.add(_states);
_states = new States("ROAST BEEF", false);
stateList.add(_states);

//create an ArrayAdaptar from the String Array
dataAdapter = new MyCustomAdapter(this,R.layout.customlist, stateList);
ListView listView = (ListView) findViewById(R.id.listView1);
// Assign adapter to ListView
listView.setAdapter(dataAdapter);

listView.setOnItemClickListener(new OnItemClickListener()
{

public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
States state = (States) parent.getItemAtPosition(position);
Toast.makeText(getApplicationContext(),"Clicked on Row: " + state.getName(),
Toast.LENGTH_LONG).show();
}
});
}

private class MyCustomAdapter extends ArrayAdapter<States>
{
private ArrayList<States> stateList;

public MyCustomAdapter(Context context, int textViewResourceId,

ArrayList<States> stateList)
{
super(context, textViewResourceId, stateList);
this.stateList = new ArrayList<States>();
this.stateList.addAll(stateList);
}

private class ViewHolder
{
TextView code;
CheckBox name;
}
@override
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder = null;
Log.v("ConvertView", String.valueOf(position));

if (convertView == null)
{

LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.customlist, null);
holder = new ViewHolder();
holder.code = (TextView) convertView.findViewById(R.id.code);
holder.name = (CheckBox) convertView.findViewById(R.id.checkBox1);
red = (TextView) convertView.findViewById(R.id.flower);
convertView.setTag(holder);

final ViewHolder finalHolder = holder;
holder.name.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
final CharSequence[] dilogList = {"LETTUCE", "TOMATOES", "PEPPERS"," RED ONION", "SPINACH"};
AlertDialog.Builder multChoiceDialog = new AlertDialog.Builder(MainActivity.this);
multChoiceDialog.setTitle("CHOOSE YOUR VEGGIES");

boolean[] _selections = new boolean[dilogList.length];

multChoiceDialog.setMultiChoiceItems(dilogList, _selections, new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog,
int whichButton, boolean isChecked) {
}
});


multChoiceDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@override
public void onClick(DialogInterface dialog, int which) {
// getting listview from alert box
ListView list = ((AlertDialog) dialog).getListView();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.getCount(); i++) {
boolean checked = list.isItemChecked(i);
// get checked list value
if (checked) {
if (sb.length() > 0)
sb.append(",");
sb.append(list.getItemAtPosition(i));
}
}


red.setText(sb);
}
});


multChoiceDialog.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
@override
public void onClick(DialogInterface dialog, int which) {
// cancel code here
}
});
AlertDialog alert1 = multChoiceDialog.create();
alert1.show();

} else {

red.setText("");

}

}
});

holder.name.setOnClickListener( new View.OnClickListener()
{
public void onClick(View v)
{
CheckBox cb = (CheckBox) v;
States _state = (States) cb.getTag();
_state.setSelected(cb.isChecked());
}
});

}
else
{
holder = (ViewHolder) convertView.getTag();
}
States state = stateList.get(position);
holder.code.setText(" (" + state.getCode() + ")");
holder.name.setText(state.getName());
holder.name.setChecked(state.isSelected());
holder.name.setTag(state);

return convertView;
}

}
private void checkButtonClick()
{

Button myButton = (Button) findViewById(R.id.findSelected);
myButton.setOnClickListener(new OnClickListener()
{

@override
public void onClick(View v)
{
StringBuffer responseText = new StringBuffer();
responseText.append("YOUR ORDER ACCEPTED...\n");
ArrayList<States> stateList = dataAdapter.stateList;
yellow= (String) red.getText();
for(int i=0;i<stateList.size(); i++)
{
States state = stateList.get(i);
if(state.isSelected())
{
responseText.append("\n" + state.getCode()+" "+" WITH"+" "+ yellow );
}
}

Toast.makeText(getApplicationContext(),
responseText, Toast.LENGTH_LONG).show();
}
});
}

}



custom activity

import android.widget.TextView;

public class States
{

String code = null;
String name = null;
boolean selected = false;

public States(String code, boolean selected)
{
super();

this.code = code;
this.name = name;
this.selected = selected;
}

public String getCode()
{
return code;
}

public void setCode(String code)
{
this.code = code;
}
public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}


public boolean isSelected()
{
return selected;
}

public void setSelected(boolean selected)
{
this.selected = selected;
}

}

main xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#ffeeeeee">

<Button android:id="@+id/findSelected"
android:layout_width="156dp"
android:layout_height="wrap_content"
android:text="ORDER" />

<ListView android:id="@+id/listView1" android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</LinearLayout>


custom xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip">

<CheckBox android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:focusable="false"
android:textColor="#ff00bb88"
android:focusableInTouchMode="false"
android:text="checkbox" />

<TextView android:id="@+id/code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/checkBox1"
android:layout_alignBottom="@id/checkBox1"
android:layout_toRightOf="@id/checkBox1"
android:text="textview"
android:textColor="#ff000000"/>


<TextView android:id="@+id/flower"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff000000"
android:singleLine="false"
android:text="FFF"
android:layout_marginRight="60dp"
android:layout_marginEnd="60dp"
android:layout_alignBottom="@+id/checkBox1"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:visibility="invisible" />


</RelativeLayout>
 
Back
Top Bottom