예제 #1
0
 /**
  * 设置左右比例
  *
  * @param left 左边占权重
  * @param right 右边占权重
  */
 public void setScale(int left, int right) {
   setWeightSum(left + right);
   LayoutParams leftParams = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, left);
   mListView1.setLayoutParams(leftParams);
   LayoutParams rightParams = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, right);
   mListView2.setLayoutParams(rightParams);
 }
예제 #2
0
  private void init(Context context) {
    setOrientation(HORIZONTAL);
    setWeightSum(2);

    mListView1 = new FixedHeightListView(context);
    mListView2 = new FixedHeightListView(context);

    mListView1.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
    mListView2.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);

    mListView2.setDivider(null);

    LayoutParams params = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1);

    mListView1.setLayoutParams(params);
    mListView2.setLayoutParams(params);
    mListView1.setVerticalScrollBarEnabled(false);
    mListView2.setVerticalScrollBarEnabled(false);

    addView(mListView1);
    addView(mListView2);
  }
예제 #3
0
 /**
  * 设置左边选择事件回调
  *
  * @param listener 回调接口
  */
 public void setLeftOnSelected(AdapterView.OnItemClickListener listener) {
   mListView1.setOnItemClickListener(listener);
 }
예제 #4
0
 /**
  * 设置右侧适配器
  *
  * @param adapter 右侧适配器
  */
 public void setRightAdapter(ListAdapter adapter) {
   mListView2.setAdapter(adapter);
 }
예제 #5
0
 /**
  * 设置左侧适配器
  *
  * @param adapter 左侧适配器
  */
 public void setLeftAdapter(ListAdapter adapter) {
   mListView1.setAdapter(adapter);
 }
예제 #6
0
 /**
  * 设置右边选择事件回调
  *
  * @param listener 回调接口
  */
 @SuppressWarnings("unused")
 public void setRightOnSelected(AdapterView.OnItemClickListener listener) {
   mListView2.setOnItemClickListener(listener);
 }