I have a 2-column list layout like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_marginLeft="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/TRAIN_CELL"
android:layout_width="275dip"
android:layout_height="wrap_content"
android:textSize="16sp"/>
<TextView android:id="@+id/TO_CELL"
android:layout_width="25dip"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@color/light_best_blue"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
But the line: android:layout_marginLeft=”10dp” does not produce and effect of adding space. Also, the screen itself has a left margin but the list does not respond to that as well.
Is there a way to make sure there is spacing on the left side of the screen?
Thanks!
Here is the code:
private List<HashMap<String, String>> fillMaps;
private SimpleAdapter adapter;
ListView list = null;
list = (ListView) findViewById(android.R.id.list);
// My data
fillMaps = new ArrayList<HashMap<String, String>>();
adapter = new SimpleAdapter(this, fillMaps, R.layout.questions_list,
new String[] {"train", "to"},
new int[] {R.id.TRAIN_CELL, R.id.TO_CELL});
//adapter = new ArrayAdapter<Question>(this, R.layout.user_question_list, questions);
setListAdapter ( adapter );
ListView lv = getListView();
lv.setTextFilterEnabled(true);
and later I populate the list like this:
HashMap<String, String> map = new HashMap<String, String>();
JSONObject o = obj.getJSONObject(i);
String question_id = o.getString("question_id");
String question = o.getString("question");
String questioner_id = o.getString("member_id");
String first_name = o.getString("first_name");
String last_name = o.getString("last_name");
Question q = new Question ( );
q.setQuestion(question);
q.setQuestionId(question_id);
q.setQuestionByMemberId( questioner_id );
q.setAuthorName(first_name + " " + last_name );
map.put("train", question);
//map.put("from", ">");
map.put("to", ">");
fillMaps.add(map);
questions.add( q );
try change
to