Android Open Source - android-custom-views-sample User View Compound






From Project

Back to project page android-custom-views-sample.

License

The source code is released under:

Apache License

If you think the Android project android-custom-views-sample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.danlew.customviews.view;
/*from  w w  w.j av a 2 s.c  o m*/
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.danlew.customviews.R;

/**
 * Simple UserView that wraps multiple Views together. Does nothing else.
 */
public class UserViewCompound extends LinearLayout {

    private ImageView mIconView;
    private TextView mNameView;

    public UserViewCompound(Context context) {
        super(context);

        setOrientation(LinearLayout.VERTICAL);
        setGravity(Gravity.CENTER);

        LayoutInflater.from(context).inflate(R.layout.user_view_merge, this);
        mIconView = (ImageView) findViewById(R.id.icon);
        mNameView = (TextView) findViewById(R.id.name);
    }

    public void setIcon(int drawable) {
        mIconView.setImageResource(drawable);
    }

    public void setName(CharSequence name) {
        mNameView.setText(name);
    }
}




Java Source Code List

net.danlew.customviews.SampleActivity.java
net.danlew.customviews.data.User.java
net.danlew.customviews.view.CircleView.java
net.danlew.customviews.view.SampleView.java
net.danlew.customviews.view.UserViewAttrs.java
net.danlew.customviews.view.UserViewCircle.java
net.danlew.customviews.view.UserViewCompound.java
net.danlew.customviews.view.UserViewEncapsulated.java