小编Van*_*nja的帖子

将公共代码添加为git子模块的问题:"已存在于索引中"

我是git的新手,非常感谢帮助添加子模块.我收到了两个共享一些常用代码的项目.共享代码刚刚复制到两个项目中.我为公共代码创建了一个单独的git repo,并将其从计划中删除,并计划将其添加为git子模块.

我使用git submodule add的path选项来指定文件夹:

git submodule add url_to_repo projectfolder
Run Code Online (Sandbox Code Playgroud)

但后来得到了错误:

'projectfolder' already exists in the index"
Run Code Online (Sandbox Code Playgroud)

这是我的存储库的理想结构:

repo
|-- projectfolder
    |-- folder with common code
Run Code Online (Sandbox Code Playgroud)

可以直接在repo中添加git子模块,也可以将其添加到新文件夹中,但不能添加到项目文件夹中.问题是它确实需要在项目文件夹中.我能做些什么以及我对git submodule add的路径选项有什么误解?

git git-submodules

199
推荐指数
6
解决办法
11万
查看次数

相当于Android上的Android ViewPager?滑动/翻阅数据页面

在Android上,使用ViewPager和Fragments可以通过相同的布局在几页数据之间进行浏览.用户向左或向右滑动,页面也会改变.所有页面只有一个视图控制器和一个布局资源,但用户浏览时数据内容会发生变化.左右滑动也有动画效果,您可以看到下一页的内容已经加载.

在iOS上与此相同的是什么?

layout ios swipe-gesture

40
推荐指数
3
解决办法
4万
查看次数

ListView分隔符不可见

ListActivity使用BaseAdapter的扩展和以下布局:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:orientation="vertical"     
        android:background="@color/application_background_color">

<ListView android:id="@android:id/list" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:drawSelectorOnTop="false"
    android:divider="@drawable/divider"
    android:dividerHeight="2dip" android:clickable="true"
    android:choiceMode="singleChoice"    
    android:cacheColorHint="@color/application_background_color">
</ListView>

   </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

它为行扩展了以下布局:

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TextView android:id="@+id/Row" 
        android:layout_width="fill_parent" android:layout_height="50dip"
        android:textSize="20dip" android:textColor="#000000"
        android:layout_margin="8dip"
        android:gravity="center_vertical"></TextView>

    </LinearLayout>   
Run Code Online (Sandbox Code Playgroud)

drawable/divider.xml目前看起来像这样,但我尝试了所有不同的类型:

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="line">
      <stroke android:color="#FF000000">
      </stroke>
    </shape>    
Run Code Online (Sandbox Code Playgroud)

如果我从图像中读取可绘制的图像就可以了.当我将drawable定义为.xml文件时,为什么它不起作用?

更新:
代码遵循与Android Developer示例中的EfficientAdapter相同的模式:http:
//developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

android divider

6
推荐指数
1
解决办法
5014
查看次数

当电话日历是非格里高利时,如何以格里高利格式获取今天的日期?

NSDate *now = [[NSDate alloc] init];  
Run Code Online (Sandbox Code Playgroud)

给出当前日期.

但是,如果电话日历不是格里高利(在模拟器上还有日语和佛教徒),则当前日期将不是格里高利.

现在的问题是如何转换为公历日期或确保它从一开始就是格里高利格式.这对于某些服务器通信至关重要.

谢谢!

objective-c gregorian-calendar

4
推荐指数
1
解决办法
8534
查看次数