[英]Xamarin forms iOS, How to customize navigation bar?
I am working with one project where we already customized actionbar for android in such a way: 我正在一个项目中工作,我们已经以这种方式为Android自定义了动作栏:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="5dp"
android:paddingTop="5dip"
android:paddingBottom="5dip">
<ImageView
android:id="@+id/ImgSmallC"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/smallC"
android:background="@drawable/back"
android:paddingRight="10dip"
android:paddingLeft="10dip"
android:layout_marginRight="25dp" />
<FrameLayout
android:id="@+id/LayoutProvider"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/ImgSmallC">
<TextView
android:id="@+id/txtProvider"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textSize="20dip"
android:textColor="#c6c6c6"
android:paddingRight="35dip"
android:paddingLeft="10dip"
android:background="@drawable/back"
android:text="Test"
android:layout_gravity="right"
android:gravity="center_vertical" />
<ImageView
android:id="@+id/imgArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/dropdown"
android:layout_marginRight="5dp"
android:layout_gravity="center_vertical|right" />
</FrameLayout>
</RelativeLayout>
Here is defined image which is in the center and text which is merged with image , so they both looks like button. 这是在中心定义的图像,以及与image合并的文本,因此它们看起来都像按钮。 Also I implemented some logic in C# code, where we used this .axml file as a layout: 我还用C#代码实现了一些逻辑,我们在其中使用了.axml文件作为布局:
LayoutInflater inflater = (LayoutInflater)ActionBar.ThemedContext.GetSystemService(LayoutInflaterService);
View customActionBarView = inflater.Inflate(Resource.Layout.actionbar_custom_view_done, null);
How can I to do same with iOS project? 我该如何使用iOS项目做同样的事情? As I understand iOS doesn't have .axml files , because they are specific android file. 据我了解,iOS没有.axml文件,因为它们是特定的android文件。 I tried to find documentation examples , how to write custom layout for iOS navigation bar, but unfortunately I didn't found anything. 我试图找到文档示例,如何为iOS导航栏编写自定义布局,但是不幸的是我什么都没找到。 And I want to use that iOS layout same as I mentioned in C# code logic for android. 而且我想使用与我在android的C#代码逻辑中提到的相同的iOS布局。
UINavigationController
aka Navigation allows very little customisation in iOS UINavigationController
aka Navigation允许在iOS中进行很少的自定义
You can find the detailed documentation our website here: https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/ 您可以在以下网站找到详细的文档: https : //developer.xamarin.com/recipes/ios/content_controls/navigation_controller/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.