Questions tagged «android»

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

6
Android复数处理“零”
如果在我的strings.xml中具有以下复数资源: <plurals name="item_shop"> <item quantity="zero">No item</item> <item quantity="one">One item</item> <item quantity="other">%d items</item> </plurals> 我正在使用以下方法向用户显示结果: textView.setText(getQuantityString(R.plurals.item_shop, quantity, quantity)); 与1及更高版本配合使用时效果很好,但是如果数量为0,则显示为“ 0件”。如文档所示,仅阿拉伯语支持“零”值吗?还是我错过了什么?
83 android 

12
CSS Media Query-软键盘打破了CSS定位规则-替代解决方案?
我正在使用多个平板电脑设备-均为Android 和iOS。目前,对于所有平板电脑,我都有以下分辨率差异。 1280 x 800 1280 x 768 1024 x 768(显然是iPad) -iPad没有此问题 应用基于设备方向的样式的最简单方法是使用以下语法来使用媒体查询的方向。 @media all and (orientation:portrait) { /* My portrait based CSS here */ } @media all and (orientation:landscape) { /* My landscape based CSS here */ } 在所有平板电脑设备上都可以正常工作。但是,问题是,当设备处于纵向模式并且用户点击任何输入字段(例如,搜索)时,软键盘会弹出-这会减小网页的可见区域,并迫使其以基于横向的CSS呈现。在Android平板电脑设备上,这取决于键盘的高度。因此,最终该网页看起来很破损。因此,我不能使用CSS3的定向媒体查询来基于定向应用样式(除非有更好的媒体查询来定向定向)。这是一个小提琴http://jsfiddle.net/hossain/S5nYP/5/,它可以进行模拟-对于设备测试,请使用完整的测试页-http://jsfiddle.net/S5nYP/embedded/result/ 这是从演示页面获取的行为的屏幕截图。 因此,除了解决此问题外,还有什么替代方法,如果基于本机CSS的解决方案不起作用,我愿意接受基于JavaScript的解决方案。 我在http://davidbcalhoun.com/2010/dealing-with-device-orientation上找到了一个代码段,该代码段建议在上面添加类并以此为目标。例如: <html class="landscape"> <body> <h1 class="landscape-only">Element Heading - …

5
从Android Play商店获取数据
关闭。此问题不符合堆栈溢出准则。它当前不接受答案。 想改善这个问题吗?更新问题,使其成为Stack Overflow的主题。 5年前关闭。 改善这个问题 我已经看到一些使用Android Play商店数据的应用程序和网站。例如,应用程序或具有最高应用程序排名的网站等。但是,如何获取数据?从哪里可以解析呢?

2
Drawable-hdpi,Drawable-mdpi,Drawable-ldpi Android
我当时使用的是Android 1.5,但现在已移至最新版本。因此,Android 1.5中只有一个“可绘制”文件夹,但是现在有三个不同的文件夹用于在Android项目中存储图像。 我发现这三个文件夹的一些文章说 hdpi表示高dpi mdpi表示中等dpi ldpi表示低dpi 但是,这三个文件夹的确切用途是什么?何时应使用特定文件夹存储图像?
83 android  image 

5
FrameLayout中的Android中心视图不起作用
我有一个FrameLayout,其中有2个控件:-一个自定义视图,可在其中绘制图像和一些文本-具有文本的textview 我想同时在FrameLayout中居中,但我无法做到这一点。Texview居中就好,当我使它可见时,我的cusom视图仍保留在左侧。 <FrameLayout android:id="@+id/CompassMap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center"> <view class="com.MyView" android:id="@+id/myView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal" android:visibility="gone"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal" android:text="CENTERED" /> </FrameLayout> 对于Mathias,我在构造函数中不做任何事情,这很简单 public class MyMapView extends View { private int xPos = 0; private int yPos = 0; private Bitmap trackMap; private Matrix backgroundMatrix; private Paint backgroundPaint; private Bitmap …


4
如何使Surfaceview透明
您好,我想使我的DrawingSurface视图透明。我尝试了很多事情,但是没有用。 这是我的XML代码,使我的表面视图透明 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/icon" > </ImageView> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#00000000" > <codewalla.android.drawings.DrawingSurface android:id="@+id/drawingSurface" android:layout_width="fill_parent" android:layout_height="fill_parent" > </codewalla.android.drawings.DrawingSurface> </LinearLayout> </FrameLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/colorRedBtn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="10" android:onClick="onClick" android:text="R" /> <Button android:id="@+id/colorBlueBtn" android:layout_width="fill_parent" android:layout_height="wrap_content" …

22
如何禁用布局内的所有视图?
例如,我有: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <LinearLayout android:id="@+id/my_layout" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/my_text_view" android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/my_edit_view" android:width="100px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <View .../> <View .../> ... <View .../> </LinearLayout> </LinearLayout> 有没有办法禁用(setEnable(false))LinearLayout内部的所有元素my_layout?

10
带边框的透明圆
我正在尝试使用android中的XML创建一个只有边框的圆: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <stroke android:width="1dp" android:color="#000000"/> </shape> 我使用的代码已发布在上方。但是,我得到一个固定的磁盘而不是一个环。我想只使用XML而不使用canvas来获得输出。我究竟做错了什么? 谢谢。 编辑: 得益于以下答案,它可以正常工作。这是我的最终代码: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="0dp" android:shape="ring" android:thicknessRatio="1.9" android:useLevel="false" > <solid android:color="@android:color/transparent" /> <size android:width="100dp" android:height="100dp"/> <stroke android:width="1dp" android:color="#FFFFFF"/> </shape>


17
React-Native:java.lang.UnsatisfiedLinkError:找不到要加载的DSO:libhermes.so
我刚刚更新了项目,以使用react-native版本0.60.2。但是,当我尝试在Android设备上运行应用程序时,启动屏幕后会崩溃。我收到以下错误日志: E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: com.tjspeed, PID: 3909 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484) at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20) at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949) at java.lang.Thread.run(Thread.java:760) 这里的建议很少:https : //github.com/facebook/react-native/issues/25601,但是不幸的是,这些建议都不对我有用。请提出解决方法。

5
删除EditText的焦点边框
聚焦EditText视图时,如何删除出现的边框? 我需要它,因为该视图在屏幕上的空间很小,但是没有边框就足够了。在仿真器上运行时,会出现橙色边框,在设备上会显示蓝色边框。


6
Android离线文档和示例代码[关闭]
从目前的情况来看,这个问题不适合我们的问答形式。我们希望答案能得到事实,参考或专业知识的支持,但是这个问题可能会引起辩论,争论,民意调查或扩展讨论。如果您认为此问题可以解决并且可以重新提出,请访问帮助中心以获取指导。 7年前关闭。 我找不到适用于Android的离线文档。有人可以提供链接吗?


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.