如何将(自动滚动)垂直滚动条放在@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder2 tvholder;
ViewHolder ivholder;
LayoutInflater inflater =(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
switch (getItemViewType(position)) {
case 0:
convertView = inflater.inflate(R.layout.textcell, null);
tvholder = new ViewHolder2(convertView);
tvholder.TV.setText(getItem(position).getText());
convertView.setTag(tvholder);
break;
case 1:
convertView = inflater.inflate(R.layout.imagecell, null);
ivholder = new ViewHolder(convertView);
ivholder.IV.setImageResource(getItem(position).getImage());
convertView.setTag(ivholder);
break;
}
} else {
switch (getItemViewType(position)) {
case 0:
tvholder = (ViewHolder2) convertView.getTag();
tvholder.TV.setText(getItem(position).getText());
break;
case 1:
ivholder = (ViewHolder) convertView.getTag();
ivholder.IV.setImageResource(getItem(position).getImage());
break;
}
}
return convertView;
}
的左侧?
注意:我尝试修改文本框question的窗口样式,但它不起作用。
我尝试通过继承System.Windows.Forms.Panel
并在ctor中进行pinvoking,在ctor中设置Panel
,并通过覆盖CreateParams.Style
getter来调整样式。不去。
答案 0 :(得分:5)
如果您向控件添加WS_EX_LEFTSCROLLBAR
扩展样式,则会在左侧显示滚动条:
using System.Windows.Forms;
public class ExPanel : Panel
{
private const int WS_EX_LEFTSCROLLBAR = 0x00004000;
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle = cp.ExStyle | WS_EX_LEFTSCROLLBAR;
return cp;
}
}
}