Questions tagged «android»

Android是Google的移动操作系统,用于对数字设备(智能手机,平板电脑,汽车,电视,Wear,Glass和IoT)进行编程或开发。对于与Android相关的主题,请使用特定于Android的标签,例如android-intent,android-activity,android-adapter等。对于与开发或编程无关但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。


25
ADB安装因INSTALL_FAILED_TEST_ONLY而失败
我在将apk安装到我的设备时遇到问题。 adb install <.apk> 使用以上命令将返回以下内容: 5413 KB/s (99747 bytes in 0.017s) pkg: /data/local/tmp/AppClient.TestOnly.App3.apk Failure [INSTALL_FAILED_TEST_ONLY] 关于什么可能导致此问题的任何想法? 它肯定可以识别设备。apk可能有问题吗?
200 android  install  apk  adb 

8
如何单击或点击TextView文本
我知道这很简单(doh ...),但是我正在寻找一种在Android App中点击或单击TextView文本行来运行方法的方法。 我一直在考虑按钮侦听器和匿名方法侦听器调用,但是它似乎不适用于TextView。 有人可以指出一些代码片段来显示在TextView中单击或点击文本如何运行方法吗?

29
ADT需要'org.eclipse.wst.sse.core 0.0.0',但找不到
我正在Fedora 14(Linux)的全新安装上安装Android SDK。我安装了eclipse,并运行了tools / android sdk工具来安装SDK的所有Eclipse组件。当我自己选择DDMS时,便能够安装它。 对于最后一个组件-Android开发人员工具,我在下面粘贴了难看的错误消息。 现在,我陷入了Eclipse依赖地狱。 我搜索了Fedora中的可用软件包,但找不到包含满足Eclipse依赖关系所需的文件的软件包。谁能解释Eclipse要求什么以及它所驻留的Fedora软件包是什么? 丑陋的错误: Cannot complete the install because one or more required items could not be found. Software being installed: Android Development Tools 0.9.9.v201009221407-60953 (com.android.ide.eclipse.adt.feature.group 0.9.9.v201009221407-60953) Missing requirement: Android Development Tools 0.9.9.v201009221407-60953 (com.android.ide.eclipse.adt.feature.group 0.9.9.v201009221407-60953) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found

8
Android-如何替代“后退”按钮,使其无法完成我的活动?
我目前有一个活动,当它显示时,一个通知也将显示在通知栏中。 这样,当用户按下主页时,活动被推到后台,他们可以通过通知返回活动。 当用户按下“后退”按钮时,会出现问题,我的活动被销毁,但通知仍然保留,因为我希望用户能够按回去,但仍然能够通过通知进入活动。但是,当USER尝试执行此操作时,我会得到Null指针,因为它试图开始一项新活动,而不是恢复旧活动。 所以从本质上讲,我希望“后退”按钮的作用与“主页”按钮完全相同,这是到目前为止我尝试过的方法: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (Integer.parseInt(android.os.Build.VERSION.SDK) < 5 && keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { Log.d("CDA", "onKeyDown Called"); onBackPressed(); } return super.onKeyDown(keyCode, event); } public void onBackPressed() { Log.d("CDA", "onBackPressed Called"); Intent setIntent = new Intent(Intent.ACTION_MAIN); setIntent.addCategory(Intent.CATEGORY_HOME); setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(setIntent); return; …

9
ellipsize在Android中是什么意思?
我在EditText布局中添加了一个,并添加了一个提示,使其水平居中。 运行应用程序时,提示不可见。我发现我应该将的ellipsize价值TextView设为start: <EditText android:id="@+id/number1EditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="start" android:ems="10" android:gravity="center_horizontal" android:hint="@string/hint1" /> 在Android文档中,我读到: 如果设置,则导致长于视图宽的单词被 省略,而不是在中间断开。 问题是ellipsize在字典中找不到。有人可以向我解释我们可以通过ellipsize属性获得什么好处吗?和之间有什么区别start,end,middle?

27
警告:API'variant.getJavaCompile()'已过时,已被'variant.getJavaCompileProvider()'取代
同步Gradle时突然出现此错误: 警告:API'variant.getJavaCompile()'已过时,已被'variant.getJavaCompileProvider()'取代。它将在2019年底删除。有关更多信息,请参见https://d.android.com/r/tools/task-configuration-avoidance 受影响的模块:应用 我build.gradle为应用模块准备了这个: apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'com.google.gms.google-services' apply plugin: 'io.fabric' android { compileSdkVersion 28 buildToolsVersion "28.0.2" defaultConfig { applicationId "..." minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "..." testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" versionNameSuffix = version_suffix [...] } buildTypes { release { minifyEnabled false …

17
app-release-unsigned.apk未签名
我在github上下载了一个Android应用程序的zip文件,我正在尝试运行它,但是出现了一条对话框,显示以下消息 app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog. 我正在使用Android Studio。我应该做些什么?


9
设置Android布局元素的背景色
我正在尝试克隆某种活动的设计 从Android UI设计的一组幻灯片中设计。但是我有一个非常简单的任务的问题。 我已经创建了如图所示的布局,并且标题是TextView一个RelativeLayout。现在,我想更改的背景颜色RelativeLayout,但是似乎无法弄清楚该怎么做。 我知道可以在XML文件android:background的RelativeLayout标记中设置属性,但是该将其设置为什么呢?我想定义一种可以在多个地方使用的新颜色。是a drawable还是a string? 另外,我希望从Eclipse Android UI设计器中找到一种非常简单的方法,我一定会错过这种方法吗? 我目前有点沮丧,因为这应该是一次最多点击几下就可以进行的一项活动。因此,非常感谢您的帮助。:)

4
如何使用复合可绘制对象而不是包含ImageView和TextView的LinearLayout
针对我的代码运行新的Lint工具。它提出了很多好的建议,但是我不明白这一点。 此标签及其子标签可以替换为一个和一个可绘制的复合标签 问题:检查当前节点是否可以使用复合drawables替换为TextView。 包含ImageView和TextView的LinearLayout可以作为复合可绘制对象更有效地处理 这是我的布局 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerInParent="true"> <ImageView android:id="@+id/upImage" android:layout_width="20dp" android:layout_height="20dp" android:layout_gravity="center_vertical" android:scaleType="centerInside" android:src="@drawable/up_count_big"> </ImageView> <TextView android:id="@+id/LikeCount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="2dp" android:layout_marginBottom="1dp" android:textColor="@color/gray" android:textSize="16sp" android:layout_gravity="center_vertical"> </TextView> </LinearLayout> 有人可以提供在这种情况下如何制作复合画的具体示例吗?


6
Android:通过数组以编程方式创建微调器
我是Android的新手,我正在尝试以编程方式创建一个微调器,并向其提供来自数组的数据,但是Eclipse会警告我无法处理。 这是我得到的: 此ArrayList包含应该位于微调器中的元素(稍后从文件填充): ArrayList<String> spinnerArray = new ArrayList<String>(); 这是我在应该创建微调器的网站上找到的代码: Spinner spinner = new Spinner(this); ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray); spinner.setAdapter(spinnerArrayAdapter); 现在第二行(ArrayAdapter ...)在Eclipse中给了我警告"ArrayAdapter is a raw type... References to generic type ArrayAdapter<T> should be parameterized",我不知道如何解决此问题(或者首先是什么意思:))。 这只是一个警告,该应用程序似乎可以正常运行,但是我仍然想了解问题所在并进行修复。任何提示表示赞赏。 问候,Select0r
198 android  spinner 

16
缩放图像以填充ImageView宽度并保持宽高比
我有一个GridView。的数据GridView是来自服务器的请求。 这是中的项目布局GridView: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/analysis_micon_bg" android:gravity="center_horizontal" android:orientation="vertical" android:paddingBottom="@dimen/half_activity_vertical_margin" android:paddingLeft="@dimen/half_activity_horizontal_margin" android:paddingRight="@dimen/half_activity_horizontal_margin" android:paddingTop="@dimen/half_activity_vertical_margin" > <ImageView android:id="@+id/ranking_prod_pic" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:contentDescription="@string/app_name" android:scaleType="centerCrop" /> <TextView android:id="@+id/ranking_rank_num" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/ranking_prod_num" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/ranking_prod_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> 我从服务器请求数据,获取图像网址并将图像加载到 Bitmap public static Bitmap loadBitmapFromInputStream(InputStream is) { return BitmapFactory.decodeStream(is); } public …
198 android  imageview 

2
Android:如何为LinearLayout绘制边框
我有三个文件。XML,绘图功能和主要活动。LinearLayout我的XML文件中有一些。 <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ef3" android:id="@+id/img01"/> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#E8A2B4" android:id="@+id/img02"/> </LinearLayout> 这是绘制函数: public class getBorder extends TextView { public getBorder(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(android.graphics.Color.RED); canvas.drawLine(0, 0, this.getWidth() - 1, …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.