我正在编写将 Pascal 转换为 C 的程序,需要一些帮助。我从扫描仪生成器 Flex 开始。我定义了一些规则并创建了或多或少工作正常的扫描仪。它将 Pascal 语法分解为标记,目前它只打印它发现的内容。但我不知道接下来该怎么做。有没有涉及这个主题的文章或书籍?你下一步怎么做?
如何在 中的项目之间显示垂直和水平分隔线LazyVerticalGrid?
因为LazyColumn可以这样做:
LazyColumn(...) {
items(items) { item ->
Row(item)
Divider()
}
}
Run Code Online (Sandbox Code Playgroud)
它也适用LazyVerticalGrid,但我不确定如何显示项目之间的垂直分隔线?
我在我的Android应用程序中使用OSMDroid.一切正常,但我无法显示图标以显示我当前的位置.遵循我的准则:
openMapView = (org.osmdroid.views.MapView) v.findViewById(R.id.openmapview);
openMapView.setClickable(true);
openMapView.setMultiTouchControls(true);
final float scale = getResources().getDisplayMetrics().density;
final int newScale = (int) (256 * scale);
String[] OSMSource = new String[2];
OSMSource[0] = "http://a.tile.openstreetmap.org/";
OSMSource[1] = "http://b.tile.openstreetmap.org/";
XYTileSource MapSource = new XYTileSource(
"OSM",
null,
1,
18,
newScale,
".png",
OSMSource
);
openMapView.setTileSource(MapSource);
mapController = (MapController) openMapView.getController();
mapController.setZoom(14);
// My Location Overlay
myLocationoverlay = new MyLocationOverlay(getActivity(), openMapView);
myLocationoverlay.enableMyLocation(); // not on by default
myLocationoverlay.enableCompass();
myLocationoverlay.disableFollowLocation();
myLocationoverlay.setDrawAccuracyEnabled(true);
myLocationoverlay.runOnFirstFix(new Runnable() {
public void run() {
mapController.animateTo(myLocationoverlay.getMyLocation());
}
});
Run Code Online (Sandbox Code Playgroud)
任何人都可以给我一个想法,我要去哪里以及我的代码应该改变什么.
String expiryDate = "2016-03-14";
private String formatDateTime(String expiryDate, String expiryTime) {
SimpleDateFormat input = new SimpleDateFormat("yyyy-mm-dd");
SimpleDateFormat output = new SimpleDateFormat("MMM, dd, yyyy");
try {
String formattedDate = output.format(input.parse(expiryDate ));// parse input
return formattedDate + ", " + expiryTime;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
但是当它返回它时,2016年1月14日.
期望的产量是2016年3月14日
我使用以下代码启动相机,但是,3/4的时间,照片无法保存到内存中.这只发生在Galaxy SIII上.它适用于Nexus S和Nexus One
public void photoNew() {
holdingImage = getContentResolver().insert(MUtil.genImgUri(), new ContentValues());
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Bundle extras = new Bundle();
extras.putParcelable(MediaStore.EXTRA_OUTPUT, holdingImage);
extras.putBoolean("return-data", true);
i.putExtras(extras);
startActivityForResult(i, REQ_PHOTO);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试解析一些HTML代码并检索img标记的内容.我使用以下代码来执行此操作:
Spanned img = Html.fromHtml(sourceText);
Run Code Online (Sandbox Code Playgroud)
当我开始调试并查看Spanned img对象的内容时,我可以看到mSpans包含一个ImageSpan,这个ImageSpans源是正确的url.虽然我在检索源码时遇到了极大的困难.关于从Spanned对象检索ImageSpan的文档非常不清楚.我试过这个方法:
ImageSpan[] spans = img.getSpans(0, img.length(), ImageSpan.class);
Run Code Online (Sandbox Code Playgroud)
但这只会返回一个空数组.
所以要清楚:我想在Spanned对象中检索ImageSpan.
我有一个列表视图,其项目是一个linearlayout,它有一个按钮作为它的子视图.我希望linearlayout的ontouchLIstener能够正常工作.我不想用onInterceptTouchEvent.有没有办法可以通过触摸将该按钮传递给父列表视图.我试过这个 - 从按钮的onTouchListener返回true
private View.OnTouchListener buttonListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
Log.i(TAG, "Button On Touch");
return true;
}
};
Run Code Online (Sandbox Code Playgroud)
但这不起作用.它不会将触摸事件传递给线性布局onTouchListener.
一定有它应该工作.
我有以下XML TextView布局:
<TextView
android:layout_width="100dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:id="@+id/txt0027_PDY911"
android:tag="canPlot"
style="@style/STD_Block_BEL.FieldLabel"
android:text="0.00" />
Run Code Online (Sandbox Code Playgroud)
绑定了一个onTouch()事件。
在onTouch()中,我需要获取textview的ID(txt0027_PDY911)作为字符串,以便对其进行查询。
getId()返回一个整数-如何获取字符串?
谢谢
我有以下代码片段!我在对ArrayAdapter构造函数的超级调用上遇到错误.我无法弄清楚为什么它没有在构造函数调用super中获取地图列表!
错误:无法解析方法
super(android.App.activity, int, java.util.List<java.util.Map<java.lang.String, java.lang.String>>)
Run Code Online (Sandbox Code Playgroud)
public class ListAdapter extends ArrayAdapter<List<Map<String,String>>> {
private Context m_Context;
private String[] m_ItemName;
private Integer[] m_ImgId;
public ListAdapter(Activity context, List<Map<String,String>> myList) {
super(context, R.layout.org_list_single_item, myList);
this.m_Context=context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(m_Context).inflate(R.layout.org_list_single_item, parent, false);
TextView txtTitle = (TextView) convertView.findViewById(R.id.img_dtl);
ImageView imageView = (ImageView) convertView.findViewById(R.id.img);
txtTitle.setText(m_ItemName[position]);
imageView.setImageResource(m_ImgId[position]);
}
return convertView;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我需要调试我的应用程序,并调试runnable内的代码,并在应用程序中执行一些操作然后再次调试代码,但我不能这样做,我不能做任何操作,调试点立即激活.
代码:
public class UpdateHandler {
public static Handler getHandler() {
if (sHandler == null) {
HandlerThread looper = new HandlerThread("update Handler");
looper.start();
sHandler = new Handler(looper.getLooper());
}
return sHandler;
}
}
UpdateHandler.getHandler().post(new Runnable() {
@Override
public void run() {
update();
}
});
public void update() {
// i put the debug point here .
}
Run Code Online (Sandbox Code Playgroud)