Question

how i can create the this layout alt text

Was it helpful?

Solution

This layout is a ListView. You can control ListViews row contents by creating an adapter and an adapterview class. The entire code is too extensive to post on here, but I will try and give you the gist of it.

main.xml:

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

Prog.java:

List<MyClass> myClassList = = new ArrayList<MyClass>();
ListView list = (ListView)findViewById(R.id.lvList);
MyClassAdapter adapter = new MyClassAdapter (this, myClassList);
list.setAdapter(adapter); 

MyClassAdapater.java:

public class MyClassAdapater extends BaseAdapter
{
    private Context context;
    private List<MyClass> list;
    public MyClassAdapater(Context context, List<MyClass> list)
    {
        this.context = context;
        this.list= list;
    }
    public View getView(int position, View view, ViewGroup viewGroup) 
    {
        MyClass entry = list.get(position);
        return new MyClassAdapterView(context,entry);
    }
}

MyClassAdapterView.java:

public class MyClassAdapterViewextends LinearLayout
{   
    public MyClassAdapterView(Context context, MyClassentry) 
    {
        super(context);

        this.setOrientation(VERTICAL);
        this.setTag(entry);

        View v = inflate(context, R.layout.row, null);
        ...
        addView(v);
    }
}

From there you'll need to create a new xml file "row" that contains a LinearLayout of the content you want.

OTHER TIPS

I think that's a list view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top