Questions tagged «android»

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

11
在Android Studio中更改矢量素材的填充颜色
Android Studio现在在21+上支持矢量资产,并将在编译时为较低版本生成png。我有一个矢量素材(来自“材质图标”),我想更改填充颜色。这适用于21+,但生成的png不会更改颜色。有没有办法做到这一点? <vector android:height="48dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@color/primary" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>

11
简单的Android RecyclerView示例
我已经使用Android做了几次项目清单RecyclerView,但这是一个相当复杂的过程。遍历众多在线教程之一(this,this和this很好),但是我正在寻找一个简单的示例,可以复制和粘贴以快速启动并运行。仅需要以下功能: 垂直布局 每行一个TextView 响应点击事件 因为我曾多次希望这样做,所以我最终决定在下面做出答案,以供将来参考。



18
Android adb“无法打开同步连接!”
大部分时间,我都可以在手机上运行和调试Android应用。然后,似乎是随机的,当我尝试从Eclipse运行或调试应用程序时,Eclipse中的控制台显示: [2010-10-12 09:36:48 - myapp] Android Launch! [2010-10-12 09:36:48 - myapp] adb is running normally. [2010-10-12 09:36:48 - myapp] Performing com.mycompany.myapp.MyActivity activity launch [2010-10-12 09:36:48 - myapp] Automatic Target Mode: using device 'HT01TP800561' [2010-10-12 09:36:48 - myapp] Uploading myapp.apk onto device 'HT01TP800561' [2010-10-12 09:36:48 - myapp] Failed to upload myapp.apk …
168 android  eclipse  adb 

14
如何将现有的Android项目导入Eclipse?
我正在尝试将现有的Android项目导入到我当前的Eclipse工作区中。我选择“文件”->“新建”->“ Android项目”,这将打开Android项目对话框,然后选择“从现有源创建项目”,“位置”,“构建目标”和“完成”。 我收到以下错误:无效的项目描述。 有人知道如何克服这个错误吗?
168 android  eclipse 

14
Android:如何检查ScrollView内部的View是否可见?
我有一个ScrollView包含一系列的Views。我希望能够确定一个视图当前是否可见(如果该视图的任何部分当前由显示ScrollView)。我希望下面的代码可以做到这一点,令人惊讶的是它没有: Rect bounds = new Rect(); view.getDrawingRect(bounds); Rect scrollBounds = new Rect(scroll.getScrollX(), scroll.getScrollY(), scroll.getScrollX() + scroll.getWidth(), scroll.getScrollY() + scroll.getHeight()); if(Rect.intersects(scrollBounds, bounds)) { //is visible }

10
在NumberPicker上禁用软键盘
我试图在使用NumberPicker输入数字值(出于美观原因)时停用软键盘。这是我的layout-xml-code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="30dp" android:layout_marginTop="30dp" > <NumberPicker android:id="@+id/repetitionPicker" android:layout_width="40dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/repetitions_short_divider" android:textAppearance="?android:attr/textAppearanceMedium" /> <NumberPicker android:id="@+id/weightPicker" android:layout_width="40dp" android:layout_height="wrap_content" android:layout_marginLeft="40dp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/pounds" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> <Button android:id="@+id/saveButton" android:layout_width="wrap_content" android:layout_height="wrap_content" …


8
工具栏在状态栏下方重叠
我想在我的活动中使用appcompat v21工具栏。但是我要实现的工具栏在状态栏下方重叠。我该如何解决? 这是活动布局xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <include android:id="@+id/toolbar" layout="@layout/toolbar" /> <FrameLayout android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" /> </LinearLayout> 工具栏视图: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" /> 主题风格: <style name="AppTheme" parent="MaterialNavigationDrawerTheme.Light.DarkActionBar"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> </style>

13
以编程方式设置android形状颜色
我正在编辑以使问题更简单,希望能帮助您找到正确的答案。 说我的oval形状如下: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:angle="270" android:color="#FFFF0000"/> <stroke android:width="3dp" android:color="#FFAA0055"/> </shape> 如何从活动类中以编程方式设置颜色?

12
React-Native,Android,Gen​​ymotion:ADB服务器未确认
我正在Mac上使用React-Native,Android和Genymotion。运行react-native run-android时,在启动操作结束时得到以下行: ... 04:54:40 E/adb: error: could not install *smartsocket* listener: Address already in use 04:54:40 E/adb: ADB server didn't ACK 04:54:40 E/ddms: '/Users/paulbrie/Library/Android/sdk/platform-tools/adb,start-server' failed -- run manually if necessary 04:54:40 E/adb: * failed to start daemon * 04:54:40 E/adb: error: cannot connect to daemon :app:installDebug FAILED FAILURE: Build failed …


13
即使我声明了Android权限也无法使用
我正在尝试编写代码以从Android应用发送短信,但是当我尝试发送短信时,它会向我发送错误消息: 09-17 18:37:29.974 12847-12847/**.**.****E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: **.**.****, PID: 12847 java.lang.SecurityException: Sending SMS message: uid 10092 does not have android.permission.SEND_SMS. at android.os.Parcel.readException(Parcel.java:1599) at android.os.Parcel.readException(Parcel.java:1552) at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:768) at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:310) at android.telephony.SmsManager.sendTextMessage(SmsManager.java:293) at **.**.****.MainActivity$3.onClick(MainActivity.java:70) at android.view.View.performClick(View.java:5198) at android.view.View$PerformClick.run(View.java:21147) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) …


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.