标签: custom-view

UIPickerView在Android上看起来很像

替代文字

嗨,我在一些Android应用程序中看到了上述控件.我知道它不是Android的原生,控件的名称是什么,我如何在Android中实现它?可以使用包含行为的ListView来完成吗?

iphone android custom-view

1
推荐指数
2
解决办法
4934
查看次数

Android:FrameLayout 子类不绘制

这是,什么工作:

a) 在 main.xml 中有两个 ImageView 的 FrameLayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:id="@+id/frameLayout1"
    android:layout_height="wrap_content">

    <ImageView android:src="@drawable/radar_background"
        android:id="@+id/background" android:layout_width="wrap_content"
        android:layout_height="wrap_content"></ImageView>

    <ImageView android:src="@drawable/radar_sector" android:id="@+id/sector"
        android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

b) 背景旋转动画,而前景扇区保持不变

因为我需要对背景图像做更多的工作,所以我把它放到了一个 FrameLayout 子类中,并相应地更改了 main.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:id="@+id/frameLayout1"
    android:layout_height="wrap_content">

    <com.decades.SensorTest.RadarView
        android:id="@+id/background" android:layout_width="wrap_content"
        android:layout_height="wrap_content" /> 
    <ImageView android:src="@drawable/radar_sector" android:id="@+id/sector"
        android:layout_width="wrap_content" android:layout_height="wrap_content"></ImageView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

这是新的 RadarView.java:

public class RadarView extends FrameLayout {

    private Bitmap mRadar;

    public RadarView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public RadarView(Context context) {
        super(context);
        init();
    }
    private void init() {
        mRadar = …
Run Code Online (Sandbox Code Playgroud)

performance android custom-view drawbitmap

1
推荐指数
1
解决办法
3884
查看次数

iOS从Nib文件跨多个UIViewController实例化自定义视图

我需要一个如何从nib文件实例化自定义视图的示例.我把头包裹在几个stackoverflow的帖子,但我没有得到它.也许我只需要提示如何做到这一点.

我想要做的是 - 使用界面构建器创建自定义视图.它应该是一个模板,以便我可以多次实例化它以将其添加到多个视图控制器.

到目前为止,我已经创建了名为MyIssueView.xib的自定义视图xib文件.其中只包括主视图和一些标签.

我创建了一个UIView的子类,在MyIssueView.xib中使用Outlets作为我的标签,称为IssueView.

我现在如何与IB挂钩?如何从任何ViewController实例化IssueView?

很高兴举个例子!干杯.

更新:

我现在有

IssueView.xib IssueView.h(UIView Subclass)IssueView.m

我的IssueView.h:

#import <UIKit/UIKit.h>

@interface IssueView : UIView

@property (weak, nonatomic) IBOutlet UILabel *label1;
@property (weak, nonatomic) IBOutlet UILabel *label2;
@property (weak, nonatomic) IBOutlet UILabel *label3;
@property (weak, nonatomic) IBOutlet UILabel *label4;

@end
Run Code Online (Sandbox Code Playgroud)

我的IssueView.m:

#import "IssueView.h"

@implementation IssueView
@end
Run Code Online (Sandbox Code Playgroud)

我的ViewController.m:

#import "AllIssuesViewController1.h"
#import "IssueView.h"
#import "UIView+NibLoading.h"

@interface AllIssuesViewController1 ()

@end

@implementation AllIssuesViewController1


- (void) loadView
{

}

- (void)viewDidLoad
{
    [super viewDidLoad];

    _issueView = [IssueView loadInstanceFromNib];
}
Run Code Online (Sandbox Code Playgroud)

它给了我一个错误: …

xib custom-view ios

1
推荐指数
1
解决办法
3366
查看次数

Xamarin.Android 膨胀自定义视图

与 Xamarin 的另一天。

好吧,让我直接弄清楚这一点:我是 android 开发以及 Xamarin 的新手

所以,我试图View在我的项目中创建一个自定义并尝试inflate从布局设置(或)它的视图。我创建了一个布局并试图从View.

自定义布局.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
   <EditText android:layout_height="120dp"
   android:layout_width="120dp"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

自定义布局.cs

public class Customlayout : LinearLayout
{
    public Customlayout(Context context) : base(context)
    {
        Inin();
    }
    public Customlayout(Context context, IAttributeSet attrs) : base(context, attrs)
    {
        Inin();
    }

    public Customlayout(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
    {
        Inin();
    }
    private void Inin()
    {
        LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
        View view …
Run Code Online (Sandbox Code Playgroud)

c# android custom-view android-custom-view xamarin.android

1
推荐指数
1
解决办法
2473
查看次数

如何创建自定义UIView?

我已经创建了一个UIView子类和相应的xib文件,其中我已经布置了一些UILabels和UIImageViews.我想将这个自定义UIView的多个副本放入UIViewController.

当我这样做时,它们在界面构建器中显示为空白,并且在应用程序加载时不会显示.我需要在UIView子类上实现哪些方法才能使其工作?

iphone init xib uiview custom-view

0
推荐指数
1
解决办法
6115
查看次数