假设有一个类A是父类和B扩展类A。
现在我不应该允许将类扩展A到类C( class C extends A) 或任何其他类。
怎么做?
我使用改造回调创建了应用程序。我想用文字显示一些信息。在 textView 中,我已经绑定了数据,我还需要连接一些文本。
我的代码如下
看法:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="UserProfile"
type="com.practical_session.sai.instaprouser.Profile.model.UserProfileInfo" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linear"
android:orientation="vertical"
android:background="@drawable/animation_list"
tools:context="com.practical_session.sai.instaprouser.Profile.view.ProfileActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageView"
android:layout_marginLeft="10dp"
android:layout_marginTop="8dp"
android:textSize="20dp"
android:text="@{UserProfile.username}"
android:textColor="@android:color/black" />
</RelativeLayout>
</LinearLayout>
</layout>
Run Code Online (Sandbox Code Playgroud)
模型:
public class UserProfileInfo extends BaseObservable {
@SerializedName("username")
@Expose
private String username;
@Bindable
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
Run Code Online (Sandbox Code Playgroud)
预期输出:
模型返回+“连接字符串”
我有一个场景,我的输入日期格式是yyyy-MM-dd,并且所需的输出日期格式必须是yyyy-MM-dd HH:mm:ss.SSSJava 8 或更高版本。例子:
输入:2022-03-15
预期 O/P:2022-03-15 12:00:00.000