Tag: 安卓

android:layout_weight初学者的问题

当我有以下几点时,显示四种颜色的顶部布局比底部布局区域小得多。 根据http://developer.android.com/guide/topics/ui/layout-objects.html#linearlayout ,当你添加更多的layout_weight,它应该增加面积,但在代码中减less。 任何帮助将不胜感激。 提前致谢。 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="4"> <TextView android:text="red" android:gravity="center_horizontal" android:background="#aa0000" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="3"/> <TextView android:text="green" android:gravity="center_horizontal" android:background="#00aa00" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> <TextView android:text="blue" android:gravity="center_horizontal" android:background="#0000aa" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> <TextView android:text="yellow" android:gravity="center_horizontal" android:background="#aaaa00" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"/> </LinearLayout> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <TextView android:text="row one" […]

android:用adb pushrecursion复制

我认为adb的推送是基于文件的。 我想能够推动整个文件夹。 有没有脚本的简单方法? 谢谢! 编辑:我需要使用子文件夹。 编辑:似乎adb拉是recursion的,但推不是。 所以我相应地改了标题和描述。

Android ADB停止对非根设备使用类似“force-stop”的应用程序命令

我试图停止Android 2.3.7设备上的应用程序。 但在这个版本的Android中,我不能使用“强制停止”命令。 你知道任何其他方式来closures在非rooted设备上的应用程序?

无法parsingAndroid上的MapActivity类

我有一个应用程序,有11个不同的活动。 其中一项活动是MapActivity的扩展(这是一个数据可视化的地图)。 要进行这项活动,用户必须首先通过发起活动,然后再进行其他3个活动。 启动MapActivity的代码是: Intent i = new Intent(getBaseContext(), MapVis.class); i.putExtra("edu.uml.cs.isense.visualizations.session_list", sessions); startActivity(i); 当这个被执行时,我从日志中得到以下输出: 09-01 14:36:22.389: WARN/dalvikvm(592): Class resolved by unexpected DEX: Ledu/uml/cs/isense/visualizations/MapVis;(0x44981910):0x128260 ref [Lcom/google/android/maps/MapActivity;] Lcom/google/android/maps/MapActivity;(0x44981910):0x13d330 09-01 14:36:22.389: WARN/dalvikvm(592): (Ledu/uml/cs/isense/visualizations/MapVis; had used a different Lcom/google/android/maps/MapActivity; during pre-verification) 09-01 14:36:22.389: WARN/dalvikvm(592): Unable to resolve superclass of Ledu/uml/cs/isense/visualizations/MapVis; (118) 09-01 14:36:22.389: WARN/dalvikvm(592): Link of class 'Ledu/uml/cs/isense/visualizations/MapVis;' failed […]

清单合并失败错误

我正在将我当前的项目巨大的应用程序移动到Android Studio和Gradle。 我目前被困在以下问题: Error:(87, 9) Execution failed for task ':App:processDebugManifest'. > Manifest merger failed : Attribute application@label value=(@string/app_label) from AndroidManifest.xml:87:9 is also present at ANDROID_APPLICATION:Library:unspecified:9:18 value=(@string/app_name) Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:82:5 to override 我已经尝试将以下属性添加到主AndroidManifest.xml文件中: tools:replace="android:label, *App Name*" tools:replace="android:label, @string/app_label" tools:replace="android:label" 这些属性定义都不起作用。 我究竟做错了什么?

自定义的onDraw()方法不被调用

<LinearLayout android:id="@+id/svLL" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ScrollView android:id="@+id/sv" android:layout_width="wrap_content" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"> <!– <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/scrollbar_2_text" /> –> <com.mypackage.MyDrawableView android:layout_width="fill_parent" android:layout_height="wrap_content" /> </ScrollView> </LinearLayout> public class MyDrawableView extends View { Context thisContext; public MyDrawableView(Context context, AttributeSet attr) { super(context); thisContext = context; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); final Paint paint = new Paint(); […]

LinearLayout的边距,用dp编程

是否有可能设置一个LinearLayout的边距,以编程方式但不是像素,但dp?

在Android Studio中完成代码

关于编辑的一个问题,我不知道如何简单地提出问题,所以我找不到答案 我刚刚从Eclipse转移到Mac上的Android Studio。 如果在布局文件中,我开始键入android:au,假设我想select自动文本看截图 我怎样才能完成到“自动”的“到”。 所以我只需要inputT,然后inputselect自动图文集。 由于没有“到”的选项,我应该被允许select它。 请让我知道,如果我的解释不够清楚

从GCM迁移到FCM需要?

Google刚刚宣布Google云消息传递现在是Firebase云消息传递。 这对于GCM的现有用户意味着什么以及需要什么迁移(如果有的话)?

电话号码在Android中格式化EditText

我正在制作一个简单的地址簿应用程序(定位4.2),其中需要名称,地址,城市,州,邮编和电话。 我想将input的电话号码格式化为电话号码(XXX)XXX-XXXX,但我需要将值作为string提取出来,以便在保存时将其存储在数据库中。 我怎样才能做到这一点?? 我有EditText设置为“电话号码”input,但显然不会做太多。