小编Iñi*_*igo的帖子

我应该分叉和克隆我的存储库,还是只是克隆原始存储库?

我正在使用几个GitHub存储库.到目前为止我一直在使用的过程是分叉原始存储库,然后克隆我的分支.如果我做了一些更改,我只需将它们推入我的远程分支.

我担心的是:在项目中我可能不会进行任何修改/提交,我应该像以前那样分叉原始项目并克隆我的分支,还是克隆原始项目?如果那些项目涉及一堆必须定制的文件(因此,我的本地项目与原始项目不同)会怎么样?

git github

13
推荐指数
2
解决办法
5902
查看次数

非UI片段与单身人士

我想非UI片段的主要目的是通过配置更改保留数据的存储,对吧?因此,从这个存储专用于拥有此片段的Activity,这是它在整个应用程序中使用Singleton模式的好处(这是我迄今为止所做的解决方案)?

singleton android android-configchanges android-fragments

9
推荐指数
1
解决办法
1593
查看次数

对话框中的按钮顺序

我正在给AlertDialog充气让用户发送评论.相当简单.但是我得到了这个Lint警告:

布局使用错误的按钮顺序API> = 14:创建一个相反顺序的layout-v14/chat_comment_dialog.xml文件:取消按钮应该在左边(是"@ string/send | Cancel",应该是"取消| @"字符串/发送")

所以,是的,这是解决方案,为API> = 14创建一个特定的布局并反转顺序.但是....真的吗?这真的是官方的建议吗?在某些设备中设置一个订单而在其他设备中设置不同的订单?作为用户,我会感到非常困惑.我是否应该忽略这个Lint建议,或者以其他方式,对一组设备遵循这种新模式(我认为相当混乱)

无论如何,这是布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="8dp" >

    <EditText
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/username"
        android:singleLine="true" />

    <EditText
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="180dp"
        android:gravity="top|left"
        android:hint="@string/review" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingRight="4dp"
            android:text="@string/send"
            android:textSize="18sp" />

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingLeft="4dp"
            android:text="@android:string/cancel"
            android:textSize="18sp" />
    </LinearLayout>

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

顺便说一下,我必须在XML中而不是在AlertDialog.Builder中膨胀按钮(也许这样按钮会自动自行排序),因为你设置为Builder的deafult按钮的任何onClickListener都会忽略对话框,而我必须避免这种行为来自己控制Dialog.

android android-widget android-layout android-alertdialog

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