我有一个项目,结构如下:
project/
|
|---src/
|---flavorA2/
| |
| |---java/
| | |---com.abc.flavorA.mk2
| | |-----classA.java
| | |-----classB.java
| |---res/
| |---AndroidManifest.xml
|
|---main
| |---java/
| | |---com.abc.flavorA
| | |-----classA.java
| | |-----classB.java
| | |-----classC.java
| | |-----classD.java
| |---res/
| | |---drawable/
| | |---layout/
| | |---values/
| |
| |---AndroidManifest.xml
|
|---flavorA
Run Code Online (Sandbox Code Playgroud)
flavorA将完全使用源和资源,main同时flavorA2在classA和中进行一些小的更改,并且classB包名称也更改为com.abc.flavorA.mk2.
我有这样的build.gradle文件:
...
buildTypes {
release {
runProguard false …Run Code Online (Sandbox Code Playgroud) 我是Obj-C的新手,并尝试编译与Big Number相关的Objective C文件
功能很简单,只需初始化一个大数字并使用NSLog打印出来.
我用了
#import <openssl/bn.h>
Run Code Online (Sandbox Code Playgroud)
但是xcode总是向我显示错误:
openssl/bn.h:没有这样的文件或目录.
我试图找出.h文件是否丢失,并在我的终端中键入locate:
$ locate bn.h
/Developer/SDKs/MacOSX10.6.sdk/usr/include/openssl/bn.h
/usr/include/openssl/bn.h
/usr/local/texlive/2010/texmf-dist/tex /通用/ hyph-UTF8 /模式/ TXT/hyph-bn.hyp.txt
好像我有bn.h文件,但为什么xcode阻止我编译?
谢谢你的帮助!!
我尝试通过Java代码设置我ImageButton的layout_gravity,我想要ImageButton的方式就像下面图像中橙色框架内的方式一样:

在蓝框是垂直LinearLayout充当"基地"布局,这是我想孩子布局添加到布局.
将橙色和红色都是水平LinearLayout.
该橙色布局是我想要把路ImageButton和TextView,这一次是通过XML建立
该红的布局是我试图模仿结果橙色通过Java代码布局.
这是设置Orange布局的XML代码,这是我想通过Java代码实现的效果:
<!-- Begin the Orange Layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/info_left_padding"
android:layout_marginRight="@dimen/info_right_padding" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:minHeight="@dimen/detail_min_line_item_height"
android:text="TextView" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:adjustViewBounds="true"
android:maxHeight="@dimen/abs__action_bar_default_height"
android:scaleType="fitCenter"
android:src="@drawable/navigation_cancel" />
</FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是设置Red布局的Java代码
int …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用我的简单应用程序,该应用程序将显示在从Android 2.3到Android 4.0+设备的设备上运行的用户位置.该地图未显示在真正的Android 2.3设备上.
该应用程序目前可以在Android 4.0+设备上运行并显示我想要的地图,没有任何问题.
因为它可以在Android 4.0+上显示没有任何问题的地图,所以我认为问题不应该是Google Maps V2的设置或权限有任何问题.
但是当我在Android 2.3设备上试用它时,地图区域将像下面显示的屏幕截图一样空白:

该应用使用ActionBarSherlock,Google Maps API v2和SupportMapFragment.构建针对SDK 17,min SDK 10.
我粘贴并修剪了代码以显示唯一的相关部分,如果您还需要其他任何内容,请发表评论.
activity_layout.xml
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/incident_padding_right" />
Run Code Online (Sandbox Code Playgroud)
Activity.java
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener;
import com.google.android.gms.maps.SupportMapFragment;
public class Activity extends SherlockFragmentActivity{
private static GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_layout);
............
//Set up map view
map = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
............
OnMarkerDragListener markerDragListener = new OnMarkerDragListener() {
@Override
public void onMarkerDragStart(Marker marker) {
// …Run Code Online (Sandbox Code Playgroud) 大家都知道,android有一个非常频繁的系统更新,对于每个主要的更新,只要linux内核发生变化,就需要重新编译tun.ko文件.
对于姜饼的最新更新,我发现旧的tun.ko文件是无用的,找不到从哪里得到这样的文件(我已经尝试过XDA和谷歌),所以我决定自己编译tun.ko.
我确实找到了一些介绍如何编译文件的文章和博客.我有ARM交叉编译器和android内核(来自GitHub的android镜像,因为kernel.org for android是无法访问的),但总是会出现错误,例如:
$ ARCH = arm make modules SUBDIRS = drivers/net
错误:内核配置无效.缺少include/generated/autoconf.h或include/config/auto.conf.在内核src上运行'make oldconfig && make prepare'来修复它.
/ bin/sh:/ bin/false:没有这样的文件或目录
警告:缺少符号版本转储/Users/xxx/Downloads/msm/Module.symvers; 模块将没有依赖关系和modversions.
构建模块,第2阶段./Users/xxx/Downloads/msm/scripts/Makefile.modpost:42:include/config/auto.conf:没有这样的文件或目录make [1]:*没有规则来制作目标`include /配置/ auto.conf".停止.make:* [modules]错误2
我无法弄清楚为什么会出现这些错误,任何人都可以帮助我离开?
非常感谢!
我想实现Sherlock操作栏的搜索视图小部件.我的问题是OnOptionItemSelected搜索视图项目.我在库活动中得到一个空指针异常.
菜单xml:
<item android:id="@+id/menu_search"
android:actionViewClass="com.actionbarsherlock.widget.SearchView"
android:icon="@android:drawable/ic_menu_search"
/>
Run Code Online (Sandbox Code Playgroud)
选项菜单的代码段:
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.tvguide_menu, menu);
MenuItem mSearch = menu.findItem(R.id.menu_search);
searchView = new SearchView(getSupportActionBar().getThemedContext());
searchView.setQueryHint("Search for countries…");
searchView.setOnQueryTextListener(this);
mSearch.setActionView(searchView);
mSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
}
Run Code Online (Sandbox Code Playgroud)
我点击搜索android时被迫关闭.我在下面分享了我的日志
04-17 15:10:08.508: E/AndroidRuntime(23283): FATAL EXCEPTION: main
04-17 15:10:08.508: E/AndroidRuntime(23283): java.lang.NullPointerException
04-17 15:10:08.508: E/AndroidRuntime(23283): at com.android.internal.view.menu.MenuItemImpl.toString(MenuItemImpl.java:490)
04-17 15:10:08.508: E/AndroidRuntime(23283): at java.lang.StringBuilder.append(StringBuilder.java:202)
04-17 15:10:08.508: E/AndroidRuntime(23283): at com.actionbarsherlock.app.SherlockFragmentActivity.onMenuItemSelected(SherlockFragmentActivity.java:201)
04-17 15:10:08.508: E/AndroidRuntime(23283): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:953)
04-17 15:10:08.508: E/AndroidRuntime(23283): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
04-17 15:10:08.508: E/AndroidRuntime(23283): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
04-17 …Run Code Online (Sandbox Code Playgroud) 我正在学习iOS开发并遇到导航控制器的一些问题.
我创建了一个SingleView应用程序,然后使用"嵌入导航控制器"来获得导航控件.
我遇到的问题是,在应用程序成功构建之后,只有导航栏可见,其他UI组件只是纯黑色.我试过真正的设备,清理/重建,删除应用程序和重新构建,都得到了相同的结果.
以下是截图:

故事板的屏幕截图:

单击导航控制器时:

我已经尝试更新约束和框架,因此没有琥珀色三角形警告.
已经勾选了"初始视图控制器".
码:
AppDelegate.m
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to …Run Code Online (Sandbox Code Playgroud) 一张图片胜过万字.:)没有正确显示右角.谢谢!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
tools:context=".MainActivity" >
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnCount="2"
android:rowCount="2"
android:layout_weight="6" >
<TextView
android:text="Blala:"
android:layout_weight="1"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:singleLine="true"
android:layout_weight="2"
/>
<TextView
android:text="Blalalallalalalalallaa:"
android:layout_weight="1"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_weight="2" />
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
更新:权重

我正在玩JsonReaderAndroid中的流式JSON解析器,我遇到了一个问题,即解析器不会遍历json数组中的所有项目,它只会返回第一个项目.
这是我用来解析的代码:
private ArrayList<Result> readResultsArray(JsonReader reader) throws IOException {
ArrayList<Result> results = new ArrayList<Result>();
reader.beginObject();
while (reader.hasNext()) {
String name = reader.nextName();
if (name.equals("results")){
reader.beginArray();
while (reader.hasNext()) {
results.add(readResult(reader));
}
reader.endArray();
} else {
reader.skipValue();
}
}
reader.endObject();
return results;
}
Run Code Online (Sandbox Code Playgroud)
我确信该方法readResult(reader)将解析并返回数组中的第一个对象而没有任何问题.
但读者似乎只是"忽略"了数组中的第二个对象.
这是readResult(reader)方法:
private Result readResult(JsonReader reader) throws IOException {
String from_user = null,
from_user_id_str = null,
from_user_name = null,
text = null;
Geo geo = null;
URL profile_image_url = null;
reader.beginObject();
while …Run Code Online (Sandbox Code Playgroud) android ×7
ios ×2
google-maps ×1
grid-layout ×1
ios4 ×1
json ×1
jsonreader ×1
linux-kernel ×1
objective-c ×1
openssl ×1
openvpn ×1