【发布时间】:2015-05-26 06:38:21
【问题描述】:
我以编程方式将 textview 安排到列表视图的左侧?但是在图像视图的情况下,它没有发生。为什么?下面给出了图像视图的代码。如何将其设置到列表视图的左侧.我试过了
tr.setGravity(Gravity.LEFT);
这个但仍然是图像视图在中心
tr = new TableRow(AAAView.this);
tr.setWeightSum(2);
tr.setLayoutParams(param3);
tr.setGravity(Gravity.LEFT);
final ImageView b16513 = new ImageView(AAAView.this);
b16513.setLayoutParams(param1);
b16513.setTag(getAAADetails.datalist.get(i).Assist_Comp_Mobile);
b16513.setImageResource(R.drawable.callbutton);
b16513.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:"
+ b16513.getTag().toString()));
startActivity(intent);
}
});
param1 = new TableRow.LayoutParams(
android.widget.TableRow.LayoutParams.WRAP_CONTENT,
android.widget.TableRow.LayoutParams.WRAP_CONTENT, 1);
param2 = new TableRow.LayoutParams(
android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, 1);
param3 = new TableRow.LayoutParams(
android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
android.widget.LinearLayout.LayoutParams.MATCH_PARENT, 1);
param1.setMargins(1, 0, 1, 1);
param2.setMargins(10, 0, 5, 1);
【问题讨论】:
-
你的 imageView 布局参数是 wrap_content 吗?
标签: android listview imageview alignment