Questions tagged «android»

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

6
Android中的视图重叠
Android中是否可能有重叠的视图?我想有一个ImageView在前面有一个透明的png,在后台有另一个视图。 编辑: 这就是我目前所拥有的,问题是imageView中的图像不透明,应该透明的部分只是黑色。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/gallerylayout" > <Gallery android:id="@+id/overview" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <ImageView android:id="@+id/navigmaske" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/navigmask" /> </RelativeLayout> 编辑: 我开始使用它,它是团队中另一个程序员的主题文件。刚刚改变了这个 <item name="android:background">#FF000000</item> 对此 <item name="android:background">#00000000</item>



6
输入后无法清除EditText setError消息
好的,所以我只有一个EditText字段和一个按钮,按下该按钮会触发AsyncTask。 EditText playerName = (EditText)findViewById(R.id.playerEditText); if(playerName.getText().toString().length() == 0 ) playerName.setError("Player name is required!"); else { // do async task } 问题是即使输入有效文本进行搜索后,错误消息似乎仍然存在。EditText不为空时,是否有办法消除错误?
75 android 


9
Android Studio 3.2.1升级后的构建错误
我正在从Udacity构建一个示例项目。到现在为止,这个工作还不错,但是在升级到Android Studio 3.2.1之后,我遇到了以下构建错误。 摇篮版本:4.6 项目链接:https : //github.com/udacity/ud851-Sunshine/tree/student/S02.02-Solution-Menus Could not find com.android.tools.build:aapt2:3.2.1-4818971**. Searched in the following locations: file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom file:/C:/Users/sandeepk2/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-windows.jar Required by: project :app 我该如何解决?

1
Android版式中的占位符文本(仅适用于设计过程)?
是否可以在Android Studio中创建仅在布局设计过程中可见的占位符文本? 例如,假设我有2个线性布局的TextView,它们将被动态填充。在设计阶段,我使用占位符文本来确保得到填充和正确的文本。我经常忘记删除占位符文本,因此在加载新数据期间,旧数据会瞬间出现...看起来很俗气。 如果有一个类似的字段android:placeholderText="This is placeholder text"只会在预览中显示,那将很酷。没有碰巧错过的东西吗?

12
在Android上使用SVG图标的最佳做法是什么?
我即将创建我的第一个Android本机(不是基于浏览器的)应用程序,并寻找一些有关图标创建/配置的良好实践。由于它应该支持多种设备/分辨率,因此我认为最好使用SVG来创建它们。至少有一个库:http : //code.google.com/p/svg-android/,它承诺在Android上提供对SVG的支持。 到目前为止,我还没有发现描述此库或另一个库的用法的资源,该方法可以在设备上呈现SVG图标,因此我不太愿意使用它。到目前为止,我所看到的最好的方法是使用SVG作为以不同分辨率预渲染基于png的图标的源格式。 所以我的问题是:SVG图标是直接在设备上使用而无需进行png预渲染步骤的好选择吗(完全可行),如果没有,为什么没有人使用这种方法?
75 android  svg  icons 

6
Android将视图叠加在所有内容之上?
您可以在android的所有内容之上叠加视图吗? 在iPhone中,我将新视图设置frame.origin为(0,0)并将其宽度和高度设置为的宽度和高度self.view。self.view然后,将其添加到图层将使其充当覆盖层,覆盖其后的内容(或者如果其具有透明背景,则显示其后的视图)。 android中有类似的技术吗?我意识到视图略有不同(相对布局,线性布局和框架布局有三种(或更多)类型,但是有什么方法可以不加选择地将视图叠加在所有内容之上吗?
75 java  android  layout  view 

6
VS Code可以在Android上运行吗?[关闭]
已关闭。这个问题需要更加集中。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅通过编辑此帖子来关注一个问题。 1年前关闭。 改善这个问题 有人知道MS支持运行VS Code以便它可以在Android OS上运行的计划吗?

5
Android:onDestroy()或Application类中的类似方法
我正在扩展Application类,以与需要上下文的某些全局变量一起使用。我知道Application类中有onCreate()方法在活动中的任何其他onCreate()之前被调用,但是我想知道Application类中是否存在可以重写的onDestroy()或类似方法,因此我将能够在持久性内存中存储变量,取消注册侦听器并在应用进程被杀死之前将最后一条消息发送到服务器?如果没有,还有其他方法可以做到吗?

15
如何在Android中以编程方式获取ScreenSize
Android将屏幕尺寸定义为Normal Large XLarge等。 它会自动在适当文件夹中的静态资源之间进行选择。我的Java代码中需要有关当前设备的数据。DisplayMetrics仅提供有关当前设备密度的信息。屏幕大小无可用。 我确实在这里的grep代码中找到了ScreenSize枚举, 但是对于4.0 SDK来说,这似乎不可用。有没有办法获取此信息?

11
通过意图发送短信
我想通过意图发送短信,但是当我使用此代码时,它会将我重定向到错误的联系人: Intent intentt = new Intent(Intent.ACTION_VIEW); intentt.setData(Uri.parse("sms:")); intentt.setType("vnd.android-dir/mms-sms"); intentt.putExtra(Intent.EXTRA_TEXT, ""); intentt.putExtra("address", phone number); context.startActivity(intentt); 为什么? 另外,我知道一种跟踪短信发送的方法,但是我不知道该如何编码: Starting activity: Intent { act=android.intent.action.SENDTO dat=smsto:%2B**XXXXXXXXXXXX** flg=0x14000000 cmp=com.android.mms/.ui.ComposeMessageActivity } 其中XXXXXXXXXXXX是电话号码。



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.