我正在使用php-gd创建一些文本,但是文本编码和方向存在问题我使用的是阿尔法语言,这是rtl语言,并且在同一图像中会有额外的英语短语.
问题:
imagettftext($image, 18, 0, 317, 141,$font_color, 'breeco.ttf', $Arabic->utf8Glyphs($friends[0]['name']));
Run Code Online (Sandbox Code Playgroud)
如果文本是英文"ltr",它将具有317的x位置并且它是正确的但是当它在rtl中时它将具有相同的317 x位置并且它是不正确的
无论如何要检测字符串的rtl?
我正在尝试将可点击列表添加到我的第一个带有自定义适配器的 android 应用程序中,一切都很好,但是当我使用时
mItemList.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "Clicked", Toast.LENGTH_LONG).show();
Log.d("error", "error here");
}
});
Run Code Online (Sandbox Code Playgroud)
但是没有响应没有吐司没有错误尽管列表显示良好
定制适配器
public class ItemListAdapter extends BaseAdapter {
public Context context;
public ArrayList<ItemModel> items;
.....
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View grid;
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null ) {
grid = new View(context);
grid = mInflater.inflate(R.layout.item, null);
Button bt = …Run Code Online (Sandbox Code Playgroud)