首页 \ 问答 \ 更新GitLab指令以使用服务器的新IP地址(Updating GitLab instructions to use new IP address of server)

更新GitLab指令以使用服务器的新IP地址(Updating GitLab instructions to use new IP address of server)

我在本地服务器上安装了GitLab,我用它作为内部GitHub。 我已经使用原始IP地址xxx.xxx.xxx.20进行了设置,之后它已更改为xxx.xxx.xxx.21。 但是,当我创建一个新项目时,仍然会说git clone http://xxx.xxx.xxx.20/path/to/project 。 我试图粘贴该命令并运行它,但直到我意识到IP是旧的才发生。 我如何刷新GitLab认为正在运行的IP,以便它显示新的IP?

谢谢


I installed GitLab on a local server which I use as an internal GitHub. I have set it up with an original IP address of xxx.xxx.xxx.20, and it has since changed to xxx.xxx.xxx.21. However, the instuctions when I create a new project still say git clone http://xxx.xxx.xxx.20/path/to/project. I was trying to paste that command and run it but nothing was happening until I realized the IP was the old one. How can I refresh the IP that GitLab think's it's running on so that it shows the new one?

Thanks


原文:https://stackoverflow.com/questions/50512848
更新时间:2022-07-17 07:07

最满意答案

据我所知,您将不得不使用自定义适配器,并覆盖getDropDown和getView方法。 您将能够自定义自定义布局的每个项目。

嗯......单词很好,例如更好,尝试类似的东西:

public class CustomStringArrayAdapter extends ArrayAdapter<String>
{
private Activity    myActivity;

public CustomStringArrayAdapter(Context context, int layoutResourceId, int textViewResourceId, List<String> objects, Activity act)
{
    super(context, layoutResourceId, textViewResourceId, objects);
    this.myActivity = act;
}

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent)
{
    return getCustomView(position, convertView, parent);
}

public View getCustomView(int position, View convertView, ViewGroup parent)
{
    LayoutInflater inflater = myActivity.getLayoutInflater();
    View row = inflater.inflate(R.layout.spinner_layout, parent, false);
    TextView label = (TextView) row.findViewById(R.id.spinner_textview);
    label.setText(getItem(position));
    LinearLayout layout = (LinearLayout) row.findViewById(R.id.spinner_linear_layout);

    return row;
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    LayoutInflater inflater = myActivity.getLayoutInflater();
    View row = inflater.inflate(R.layout.spinner_layout, parent, false);
    TextView label = (TextView) row.findViewById(R.id.spinner_textview);
    label.setText(getItem(position));

    return row;
    }

}

和布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_gravity="center"
    android:gravity="center"
    android:background="@drawable/transparent"
    android:id="@+id/spinner_linear_layout">
    <TextView
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="center"
        android:layout_gravity="center"
        android:textSize="21sp"
        android:singleLine="true"
        android:id="@+id/spinner_textview"
        android:textColor="@color/black" />
</LinearLayout>

(但它只是一个示例,如果要根据选择调整大小,可以在每个对象上添加一个布尔mSelected并根据此布尔值更改视图)

编辑:然后在MultiSpinner中:

删除这个:

ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(),
            android.R.layout.simple_spinner_item,
            new String[] { spinnerText });
    setAdapter(adapter);

并在微调器中添加新的自定义适配器:

MultiSpinner mMultiSpinner = (MultiSpinner) findViewById(R.id.multispinner);
mMultiSpinner.setAdapter(mCustomArrayAdapter);

As i know, you will have to use a custom adapter, and override the getDropDown and the getView methods. You will be able to customize each item customizing the layout.

Well... words are good, example better, try something like that :

public class CustomStringArrayAdapter extends ArrayAdapter<String>
{
private Activity    myActivity;

public CustomStringArrayAdapter(Context context, int layoutResourceId, int textViewResourceId, List<String> objects, Activity act)
{
    super(context, layoutResourceId, textViewResourceId, objects);
    this.myActivity = act;
}

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent)
{
    return getCustomView(position, convertView, parent);
}

public View getCustomView(int position, View convertView, ViewGroup parent)
{
    LayoutInflater inflater = myActivity.getLayoutInflater();
    View row = inflater.inflate(R.layout.spinner_layout, parent, false);
    TextView label = (TextView) row.findViewById(R.id.spinner_textview);
    label.setText(getItem(position));
    LinearLayout layout = (LinearLayout) row.findViewById(R.id.spinner_linear_layout);

    return row;
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    LayoutInflater inflater = myActivity.getLayoutInflater();
    View row = inflater.inflate(R.layout.spinner_layout, parent, false);
    TextView label = (TextView) row.findViewById(R.id.spinner_textview);
    label.setText(getItem(position));

    return row;
    }

}

And the layout :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_gravity="center"
    android:gravity="center"
    android:background="@drawable/transparent"
    android:id="@+id/spinner_linear_layout">
    <TextView
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:gravity="center"
        android:layout_gravity="center"
        android:textSize="21sp"
        android:singleLine="true"
        android:id="@+id/spinner_textview"
        android:textColor="@color/black" />
</LinearLayout>

(But it's just an sample, if you want to resize depending on the selection, you can add a boolean mSelected on each object and change the view depending on this boolean)

Edit : Then in the MultiSpinner :

Remove this :

ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(),
            android.R.layout.simple_spinner_item,
            new String[] { spinnerText });
    setAdapter(adapter);

and add the new custom adapter in the spinner :

MultiSpinner mMultiSpinner = (MultiSpinner) findViewById(R.id.multispinner);
mMultiSpinner.setAdapter(mCustomArrayAdapter);

相关问答

更多
  • 首先,您可以创建一个扩展ArrayAdapter的自定义Adapter类。 通过这种方式,您可以重写该'getDropDownView'以更改下拉弹出窗口的显示(请注意,您需要定义'customspinneritem.xml',在这种情况下只需使用TextView ej textview1) @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = getLay ...
  • 在下面一行的新的ArrayAdapter的构造函数中: ArrayAdapter beAdapter = new ArrayAdapter(this, this指向您所在的OnItemSelectedListener类的当前实例,而不是父视图,这是发生问题的原因,因为ArrayAdapter没有匹配的构造函数。 您应该尝试使用MyParentView.this (其中MyParentView是您所在MyParentView的名称),而不是传递适当的实 ...
  • 你需要改变这个: @Override public Object getItem(int position) { return menu_items_id.get(position); } @Override public long getItemId(int position) { return position; } You need to change this: @Override public Object getItem(int position) { retu ...
  • 据我所知,您将不得不使用自定义适配器,并覆盖getDropDown和getView方法。 您将能够自定义自定义布局的每个项目。 嗯......单词很好,例如更好,尝试类似的东西: public class CustomStringArrayAdapter extends ArrayAdapter { private Activity myActivity; public CustomStringArrayAdapter(Context context, int layoutResou ...
  • 我只是更新你的代码而不创建新的。 首先,我将回答这三个问题。 滚动后微调器正在重置,因为适配器调用getView()方法并且它们再次初始化为默认值。 要避免这种情况并恢复以前选择的值,您需要做的是将它们保存在地图中并分配回来。 在下面的代码中,“ selectedItem ”是我用来存储每个微调器的选定量的映射。 要获得总金额,您可以使用另一个地图,该地图用于存储每个微调器的总价。 在下面的代码中,我使用了“ totalPrices ”。 在onItemSelected()里面我们可以为特定的微调器提供总量 ...
  • 尝试这个, spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { String text = spinner.getSelectedItem().toString( ...
  • 上面的查询是真的,或者我使用这两个查询解决了我的问题 String selectQuery = "SELECT * FROM " + TABLE_ITEM + " WHERE " + KEY_CID + " ='" + cid + "'"; Cursor c = db.rawQuery(selectQuery, null); 要么 Cursor c = db.rawQuery("SELECT * FROM item_table WHERE _CategoryID =? " ,new String ...
  • 您需要覆盖Spinner getDropDownView方法以显示GridView 。 并且为了从Spinner选择值,请在GridView上使用OnItemClickListener来获取回调 。 例如: label.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int pos, long id) { Toast.ma ...
  • Spinner集的大小有android:layout_width="wrap_content"由其内容决定。 如果你想要椭圆化的东西,那么当你创建你的行视图时,这取决于你的SpinnerAdapter 。 或者,硬连线大小固定的android:layout_width 。 或者,不是使用LinearLayout ,而是使用RelativeLayout并构造规则,以便Spinner通过将其锚定到屏幕的左侧和第一个EditText的左侧来占用行的剩余空间。 虽然我不是百分之百确定如果内容太大会发生什么 - 它可 ...
  • requestAnimationFrame是它被浏览器有效地调用,尽可能接近60fps,或者浏览器动画引擎的帧速率,因此你不应该在requestAnimationFrame回调中工作,这需要更长的时间比一个帧时间。 请记住,在浏览器中,javascript的执行发生得非常快......需要非常复杂的javascript计算才能实际花费比执行帧时间更长的时间。 您将遇到的主要问题是屏幕上的布局,绘画和重绘元素。 为此,网络工作者不会帮助你。 如果你有非常繁重的javascript需要比执行帧时间更长的时间,网 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)