更新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
最满意答案
据我所知,您将不得不使用自定义适配器,并覆盖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 ...
-
如何通过多项选择重新调整Spinner中项目的高度?(How to re size the Height of the Items in Spinner with multiple choice?)[2023-10-11]
据我所知,您将不得不使用自定义适配器,并覆盖getDropDown和getView方法。 您将能够自定义自定义布局的每个项目。 嗯......单词很好,例如更好,尝试类似的东西: public class CustomStringArrayAdapter extends ArrayAdapter{ private Activity myActivity; public CustomStringArrayAdapter(Context context, int layoutResou ... -
我只是更新你的代码而不创建新的。 首先,我将回答这三个问题。 滚动后微调器正在重置,因为适配器调用getView()方法并且它们再次初始化为默认值。 要避免这种情况并恢复以前选择的值,您需要做的是将它们保存在地图中并分配回来。 在下面的代码中,“ selectedItem ”是我用来存储每个微调器的选定量的映射。 要获得总金额,您可以使用另一个地图,该地图用于存储每个微调器的总价。 在下面的代码中,我使用了“ totalPrices ”。 在onItemSelected()里面我们可以为特定的微调器提供总量 ...
-
Android Spinner使用MultiAutoCompleteTextView?(Android Spinner With MultiAutoCompleteTextView?)[2021-09-12]
尝试这个, 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需要比执行帧时间更长的时间,网 ...