次のような 2 列のリスト レイアウトがあります。
<?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>
しかし、次の行: android:layout_marginLeft="10dp" は生成されず、スペースを追加する効果もありません。また、画面自体には左マージンがありますが、リストもそれに反応しません。
画面の左側にスペースがあることを確認する方法はありますか?
ありがとう!
コードは次のとおりです。
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);
その後、次のようにリストに入力します。
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 );