设为首页 加入收藏

TOP

C#-Xamarin的Android项目开发(一)——创建项目(三)
2019-09-01 23:25:25 】 浏览:88
Tags:C#-Xamarin Android 项目开发 创建 项目
Object.Load(stream); callback(jsonDoc); } } } catch (Exception ex) { Log.Debug("BaseActivity", $"Exception at GetRest" + ex.Message); } }); } #endregion }

视图MainActivity.axml

Android视图是有xml语法来编写的,其中一些语法定义是很奇葩,但也只能去适应,没有别的办法。比如Android里定义ID名是这样的:android:id="@+id/btn_search"。我每次看这个@+id都感觉很奇葩,哈哈。

Xamarin的视图和Android的视图是一样的,所以我们尽可上网找一些资源来使用。

我们先修改视图代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffffff">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/title_background"
        android:paddingLeft="5dip"
        android:paddingRight="5dip"
        android:paddingTop="5dip"
        android:paddingBottom="5dip"
        android:gravity="center_vertical">
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="2">
            <TextView
                android:textAppearance="?android:textAppearanceMedium"
                android:layout_gravity="center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="KibaXamarin_Android"
                android:textColor="#ffffffff" />
            <ImageView
                android:src="@drawable/ic_arrow_down"
                android:layout_gravity="center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#ffffffff" />
        </LinearLayout>
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="5">
            <ImageButton
                android:src="@drawable/toolbar_upload_photo_normal"
                android:layout_gravity="right|center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/btn_weight" />
        </FrameLayout>
    </LinearLayout>
    <LinearLayout
        android:gravity="center"
        android:orientation="horizontal"
        android:background="@drawable/search_bar_background"
        android:padding="6.0dip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button
            android:textAppearance="?android:textAppearanceMedium"
            android:gravity="left|center"
            android:id="@+id/btn_search"
            android:layout_width="0.0dip"
            android:layout_height="wrap_content"
            android:hint="\u0020Click Me"
            android:drawableLeft="@drawabl
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Android For OpenCV的环境搭建 下一篇keyboard dialog 仿微博表情键盘..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目