Populating a multicolumn listview without a hashmap - android

I have been reading about multicolumn listviews today. They seem to be what I need, but can't info info about how to populate them not using a hash map. All examples I have seen use a hash map to build the listview data adapter but this is too heavy when lot of data is implied. Is there anyway to populate a list view without a hash list?
All examples I have seen use something like this:
http://saigeethamn.blogspot.com.es/2010/04/custom-listview-android-developer.html

Yes it is possible. please Check out the code.
public class List_view_ArrayAdapter extends ArrayAdapter<String> {
private Context context;
private String[] name;
private String[] address;
private String[] rating;
private TextView nameTextView;
private TextView addressTextView;
private ImageView lisiconImageView;
private AppManagers appManagers;
public List_view_ArrayAdapter(Context context, String[] name,
String[] address, String[] rating) {
super(context, R.layout.list_layout, name);
this.context = context;
this.name = name;
this.address = address;
this.rating = rating;
appManagers = new AppManagers();
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.list_layout, parent, false);
nameTextView = (TextView) rowView.findViewById(R.id.nameTextView);
addressTextView = (TextView) rowView.findViewById(R.id.addressTextView);
lisiconImageView = (ImageView) rowView
.findViewById(R.id.listiconImageView);
nameTextView.setText(name[position]);
addressTextView.setText(address[position]);
lisiconImageView.setImageDrawable(appManagers
.ImageOperations(rating[position]));
// imageView.setImageResource(imageid[position]);
return rowView;
}
}
Here is list_layout for this line "R.layout.list_layout"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" android:background="#d9d9d9">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginBottom="5dp" android:layout_marginTop="5dp">
<ImageView
android:id="#+id/listiconImageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:layout_marginLeft="5dp" android:gravity="center_vertical" android:layout_marginBottom="5dp" android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name : "
android:textColor="#2a170e" />
<TextView
android:id="#+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#2a170e" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address : "
android:textColor="#2a170e" />
<TextView
android:id="#+id/addressTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#2a170e" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Finaly you call it from your main Activity.
new List_view_ArrayAdapter arrayAdapter= new List_view_ArrayAdapter(context, appManagers.getNameArray(cafeandbarsList), name, address, rating);
listView.setAdapter(arrayAdapter);
I think it help you.
Thanks

Related

How to put titles for each field of a ListView item in Android

I have a Listview with a custom adapter , which displays person's data like
Barak Obama 2008
But I want to put a header with Name Surname Date but properly alligned
A draft example:
ListView Items with titles
How Can I achieve this?
thank you
Custom ListView, All what you need, A xml layout for row with adapter and listview
check out this link explain Custom listview
https://github.com/codepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView
You can use TableLayout to show your Data as your requirement. I've replicated your demand. Here are the codes.
1) MainActivity.java
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView lstview=(ListView)findViewById(R.id.listView);
// Inflate header view
ViewGroup headerView = (ViewGroup)getLayoutInflater().inflate(R.layout.header_layout, lstview,false);
// Add header view to the ListView
lstview.addHeaderView(headerView);
// Get the string array defined in strings.xml file
String[] date = {"29-03-17", "29-03-17"};
String[] amount = {"5", "2"};
String[] dept = {"14", "4"};
// Create an adapter to bind data to the ListView
CustomListViewAdapter adapter=new CustomListViewAdapter(this,R.layout.row_listview, R.id.tvDate, date, amount, dept);
// Bind data to the ListView
lstview.setAdapter(adapter);
}
2) CustomListViewAdapter.java
public class CustomListViewAdapter extends ArrayAdapter<String> {
int groupid;
String[] date;
String[] amount;
String[] dept;
ArrayList<String> desc;
Context context;
public CustomListViewAdapter(Context context, int vg, int id, String[] date, String[] amount, String[] dept){
super(context,vg, id, date);
this.context=context;
groupid=vg;
this.date=date;
this.amount=amount;
this.dept=dept;
}
// Hold views of the ListView to improve its scrolling performance
static class ViewHolder {
public TextView tvDate;
public TextView tvAmount;
public TextView tvDept;
}
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
// Inflate the rowlayout.xml file if convertView is null
if(rowView==null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView= inflater.inflate(groupid, parent, false);
ViewHolder viewHolder = new ViewHolder();
viewHolder.tvDate= (TextView) rowView.findViewById(R.id.tvDate);
viewHolder.tvAmount= (TextView) rowView.findViewById(R.id.tvAmount);
viewHolder.tvDept= (TextView) rowView.findViewById(R.id.tvDept);
rowView.setTag(viewHolder);
}
// Set text to each TextView of ListView item
ViewHolder holder = (ViewHolder) rowView.getTag();
holder.tvDate.setText(date[position]);
holder.tvAmount.setText(amount[position]);
holder.tvDept.setText(dept[position]);
return rowView;
}
}
3) HeaderLayout (header_layout.xml)
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*"
>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/tvDate"
android:layout_column="0"
android:padding="10sp"
android:gravity="left"
android:layout_span="1"
android:text="Date"
android:layout_gravity="center">
</TextView>
<TextView
android:id="#+id/tvAmount"
android:layout_column="1"
android:padding="10sp"
android:gravity="left"
android:layout_span="1"
android:text="Amount"
android:layout_gravity="center">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvDept"
android:layout_column="2"
android:layout_span="1"
android:text="Dept"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvDelete"
android:layout_column="3"
android:layout_span="1"
android:text="Delete"
android:layout_gravity="center" />
</TableRow>
</TableLayout>
4) RowLayout for each ListView row (row_listview.xml)
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tvDate"
android:layout_column="0"
android:padding="10sp"
android:gravity="left"
android:layout_span="1"
android:text="Date"
android:layout_gravity="center">
</TextView>
<TextView
android:id="#+id/tvAmount"
android:layout_column="1"
android:padding="10sp"
android:gravity="left"
android:layout_span="1"
android:text="Amount"
android:layout_gravity="center">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvDept"
android:layout_column="2"
android:layout_span="1"
android:text="Dept"
android:layout_gravity="center" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageButton"
android:layout_column="3"
android:layout_span="1"
android:src="#android:drawable/ic_delete" />
</TableRow>
</TableLayout>
5) Output:
Hope this helps.

ListView default background selector doesn't work

I'm trying to solve an issue with default background selector in list view.
I'm using a ListView with a default style. List item contains a few TextViews and an ImageButton. When the image button is not visible (Setting visibility to invisible using the adapter), the background selector works well (There is an on click animation). But, when the ImageButton is visible, there is no onclick animation when clicking on the item (Not the button)..
List item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
>
<TextView
android:id="#+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10:20:30"
android:layout_centerVertical="true"/>
<TextView
android:id="#+id/type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/time"
android:layout_marginStart="15dp"
android:layout_toStartOf="#+id/openMapButton"
android:textStyle="bold"/>
<TextView
android:id="#+id/body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Long long bodylong bodylong bodylong bodylong bodylong bodylong bodylong body"
android:layout_below="#+id/type"
android:layout_alignStart="#id/type"
android:layout_toStartOf="#+id/openMapButton"
android:ellipsize="end"
android:maxLines="2"
/>
<ImageButton
android:id="#+id/openMapButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/open_map"
android:background="#android:color/transparent"
android:padding="4dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"/>
ListView:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".events.EventsHistoryFragment">
<ListView
android:id="#android:id/list"
tools:listitem="#layout/notification_list_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Adapter:
public class EventsAdapter extends CursorAdapter {
public EventsAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
}
#Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.notification_list_item, parent, false);
EventViewHolder viewHolder = new EventViewHolder();
viewHolder.time = (TextView) view.findViewById(R.id.time);
viewHolder.type = (TextView) view.findViewById(R.id.type);
viewHolder.body = (TextView) view.findViewById(R.id.body);
viewHolder.openMapButton = (ImageButton) view.findViewById(R.id.openMapButton);
viewHolder.openMapButtonListener = new ShowMapButtonClickListener();
viewHolder.openMapButton.setOnClickListener(viewHolder.openMapButtonListener);
view.setTag(viewHolder);
return view;
}
#Override
public void bindView(View view, Context context, Cursor cursor) {
EventViewHolder viewHolder = (EventViewHolder) view.getTag();
long timestamp = cursor.getLong(EventData.TIMESTAMP_COLUMN_ID);
String type = cursor.getString(EventData.TYPE_COLUMN_ID);
String body = cursor.getString(EventData.BODY_COLUMN_ID);
double latitude = cursor.getDouble(EventData.LOCATION_LATITUDE_COLUMN_ID);
double longitude = cursor.getDouble(EventData.LOCATION_LONGITUDE_COLUMN_ID);
String humanReadableType = ServiceEvents.getReadableEventName(context, type);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Date date = new Date(timestamp);
viewHolder.time.setText(sdf.format(date));
viewHolder.type.setText(humanReadableType);
viewHolder.body.setText(body);
if(latitude == ServiceEvents.UNKNOWN_COORIDATE) {
viewHolder.openMapButton.setVisibility(View.INVISIBLE);
} else {
viewHolder.openMapButton.setVisibility(View.VISIBLE);
viewHolder.openMapButtonListener.bind(context, latitude, longitude, humanReadableType);
}
}
}
The default behavior of the android list items is determined by the selector
?android:attr/selectableItemBackground so your RelativeLayout of your ListItem should be:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/selectableItemBackground"
>
Notice the last attribute android:background="?android:attr/selectableItemBackground"

want to use my own layout at ArrayAdapter

I use the following code to use the ArrayAdapter for my ListView:
ArrayList<String> mylist = new ArrayList<String>();
String xml = ParseXMLMethods.getXML();
Document doc = ParseXMLMethods.XMLfromString(xml);
NodeList children = doc.getElementsByTagName(KEY_ITEM);
for (int i = 0; i < children.getLength(); i++) {
Element e = (Element)children.item(i);
mylist.add(ParseXMLMethods.getValue(e, KEY_TITLE));
mylist.add(ParseXMLMethods.getValue(e, KEY_CITY));
mylist.add(ParseXMLMethods.getValue(e, KEY_COUNT));
}
adapter1=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
mylist);
list2.setAdapter(adapter1);
Here I am able to see only Title, but I want to see all three in my listView Row.For this I create another layout R.layout.list_layout2 as follows:
My layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:paddingLeft="6dp"
>
<TextView
android:id="#+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="1dp"
android:textSize="16dp"
android:textStyle="bold"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="1dp"
android:textSize="12dp"
android:textColor="#000000" />
<TextView
android:id="#+id/subtitle2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textSize="12dp"
android:textColor="#000000"
android:layout_toRightOf="#+id/subtitle" />
</RelativeLayout>
</LinearLayout>
How can I use this layout?
You're going to want to look at a Custom ListView Adapter. Note that your original code uses a custom ListView but not the Adapter. You're going to want to create your own Adapter that extends ArrayAdapter since your ListView row is more complex than just one TextView.
See Tutorial and enter link description here.
Ex:
list_row.xml
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow>
<ImageView
android:id="#+id/img"
android:layout_width="50dp"
android:layout_height="50dp"/>
<TextView
android:id="#+id/txt"
android:layout_width="wrap_content"
android:layout_height="50dp" />
</TableRow>
</TableLayout>
CustomList.java
public class CustomList extends ArrayAdapter<String>{
private final Activity context;
private final String[] web;
private final Integer[] imageId;
public CustomList(Activity context, String[] web, Integer[] imageId) {
super(context, R.layout.list_single, web);
this.context = context;
this.web = web;
this.imageId = imageId;
}
#Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView= inflater.inflate(R.layout.list_row, null, true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.txt);
ImageView imageView = (ImageView) rowView.findViewById(R.id.img);
txtTitle.setText(web[position]);
imageView.setImageResource(imageId[position]);
return rowView;
}
}
In the example above, you're going to want to switch out the ImageView and replace it with your TextViews.

Set different icons for each row

Above is the main screen of my app with a custom adapter for listview. How do I put a different icon for each row in the listview? I tried putting an ImageView in the xml but it overwrites my whole screen only showing an icon.
MainAcitivty xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/hp_color"
tools:context=".MainActivity" >
<TextView
android:id="#+id/cityText"
style="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textSize="28sp" />
<ImageView
android:id="#+id/condIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_below="#id/cityText"
android:contentDescription="weather icon" />
<TextView
android:id="#+id/condDescr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/condIcon"
android:textSize="20sp" />
<ListView
android:id="#+id/mainListView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<ImageButton
android:id="#+id/btnPicturePage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:onClick="picturePage"
android:src="#drawable/photo" />
Custom adapter:
public class WeatherAdapter extends ArrayAdapter<String> {
private final Activity context;
private ArrayList<String> weatherData;
static class ViewHolder {
public TextView text;
public ImageView image;
}
public WeatherAdapter(Activity context, ArrayList<String> weatherData) {
super(context, R.layout.list, weatherData);
this.context = context;
this.weatherData = weatherData;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
// reuse views
if (rowView == null) {
LayoutInflater inflater = context.getLayoutInflater();
rowView = inflater.inflate(R.layout.list, null);
// configure view holder
ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) rowView.findViewById(R.id.rowTextView);
rowView.setTag(viewHolder);
}
ViewHolder holder = (ViewHolder) rowView.getTag();
ArrayList<String> s = new ArrayList<String>(weatherData);
String []sa = new String [s.size()];
sa = s.toArray(sa);
holder.text.setText(sa[position]);
if (sa[position].startsWith("Air pressure")) {
rowView.setBackgroundResource(R.color.skyblue) ;
}
return rowView;
}
List xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rowTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp"
android:textColor="#color/white" >
</TextView>
Your list.xml should be something similar to this (taken from one my files)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal"
android:background="#drawable/xml_pressed_bg" android:clickable="true" android:layout_width="fill_parent"
android:layout_height="54dip"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ttshow="http://schemas.android.com/apk/res-auto">
<ImageView android:id="#+id/imgThumb" android:layout_width="42.0dip" android:layout_height="42.0dip" android:scaleType="fitXY"
android:src="#drawable/sample_dj" />
<TextView android:textSize="14.0sp" android:textColor="#ff666666" android:id="#+id/txtName"
android:layout_width="180dip" android:layout_height="wrap_content"
android:singleLine="true" android:shadowColor="#99ffffff" style="#style/TextShadowLight"
android:text="Hello" android:paddingLeft="10dip"/>
</LinearLayout>
Every row item has an image (imgThumb). This needs to be changed or set to a static image, depending on your needs. This is done in the adapters' getView() method.
imgThumb.setImageResource(R.drawable.my_image);
Private TypedArray img;
img=getResource.obtainTypedArray(R.array.imgIcon)
if (sa[position].startsWith("Air pressure")) {
rowView.setBackgroundResource(R.color.skyblue) ;
holder.image.setImageResource(img.gerResourceId[0]);
}else if (sa[position].startsWith("Air Condition")) {
holder.image.setImageResource(img.gerResourceId[1]);
}

Is there a way to display TableLayout in ListView

I have 10+ tables created in xml Tablelayout and i'm trying to
put them in ListView rather than in a ScrollView .
Tables are not editable and just for info... How to put them as
data source in Adapter or i need to Inflate or what? tnx and sorry for noobish q..
You need to create custom Adapter for the ListView(please search this). With the adapter you need to create ListView item layout, where you can define your table for each row in the List View.
Hope this helps. :)
You can do it by simply adding TableLayout to ListView row layout xml.
Example from my current application:
public class DistributorsListAdapter extends ArrayAdapter<String>{
private final Context context;
private final int rowResourceId;
private final JSONArray data;
public DistributorsListAdapter(Context context, int rowResourceId, String[] ids, JSONArray data) {
super(context, rowResourceId, ids);
this.context = context;
this.rowResourceId = rowResourceId;
this.data = data;
}
#Override
public View getView(int position, View v, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(rowResourceId, parent, false);
try {
JSONObject rowData = data.getJSONObject(position);
// Заполняем данными строку списка
setHTMLData(rowView, rowData, "name", R.id.distributor_table_title );
setHTMLData(rowView, rowData, "address", R.id.distributor_address );
setData(rowView, rowData, "website", R.id.distributor_website );
setData(rowView, rowData, "phone", R.id.distributor_phone );
setData(rowView, rowData, "fax", R.id.distributor_fax );
setData(rowView, rowData, "email", R.id.distributor_email );
} catch (JSONException e) {
e.printStackTrace();
}
return rowView;
}
private void setData(View v, JSONObject data, String key, int textViewId) throws JSONException{
TextView tv = (TextView) v.findViewById(textViewId);
tv.setText(data.getString(key));
}
private void setHTMLData(View v, JSONObject data, String key, int textViewId) throws JSONException{
TextView tv = (TextView) v.findViewById(textViewId);
tv.setText( Html.fromHtml( data.getString(key) ) );
}
}
XML layout of a ListView row:
<?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:paddingLeft="#dimen/activity_horizontal_padding"
android:paddingRight="#dimen/activity_horizontal_padding"
android:paddingBottom="#dimen/distributor_table_vertical_padding">
<TextView
android:id="#+id/distributor_table_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/distributor_table_vertical_padding"
android:gravity="center_horizontal"
android:textSize="#dimen/distributor_table_title_text_size"
android:textStyle="bold"/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distributor_address"
android:textSize="#dimen/distributor_table_text_size"/>
<TextView
android:id="#+id/distributor_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/distributor_table_text_size"
android:layout_marginLeft="#dimen/distributor_table_columns_margin"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distributor_website"
android:textSize="#dimen/distributor_table_text_size"/>
<TextView
android:id="#+id/distributor_website"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/distributor_table_text_size"
android:layout_marginLeft="#dimen/distributor_table_columns_margin"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distributor_phone"
android:textSize="#dimen/distributor_table_text_size"/>
<TextView
android:id="#+id/distributor_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/distributor_table_text_size"
android:layout_marginLeft="#dimen/distributor_table_columns_margin"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distributor_fax"
android:textSize="#dimen/distributor_table_text_size"/>
<TextView
android:id="#+id/distributor_fax"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/distributor_table_text_size"
android:layout_marginLeft="#dimen/distributor_table_columns_margin"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/distributor_email"
android:textSize="#dimen/distributor_table_text_size"/>
<TextView
android:id="#+id/distributor_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/distributor_table_text_size"
android:layout_marginLeft="#dimen/distributor_table_columns_margin"/>
</TableRow>
</TableLayout>
</LinearLayout>

Categories

Resources