Xamarin格式的iOS,如何自定义导航栏?
问题描述:
我有一个项目,我们已经以这样的方式定制动作条为Android工作:Xamarin格式的iOS,如何自定义导航栏?
<?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>
这里被定义图像是其中合并图像的中心和文字,所以他们都看起来像按钮。此外,我实现在C#代码中的一些逻辑,我们用这个.axml文件作为布局:
LayoutInflater inflater = (LayoutInflater)ActionBar.ThemedContext.GetSystemService(LayoutInflaterService);
View customActionBarView = inflater.Inflate(Resource.Layout.actionbar_custom_view_done, null);
我如何做同样的与iOS项目?据我了解,iOS没有.axml文件,因为它们是特定的android文件。我试图找到文档示例,如何编写iOS导航栏的自定义布局,但不幸的是我没有找到任何东西。并且我想使用与我在Android的C#代码逻辑中提到的相同的iOS布局。
答
UINavigationController
又名导航允许很少的定制iOS中
你可以在这里找到详细的文件我们的网站:https://developer.xamarin.com/recipes/ios/content_controls/navigation_controller/