Last active
August 9, 2016 13:37
-
-
Save bassaer/ac5318db24a9e2e3cab4b0fdd53fed49 to your computer and use it in GitHub Desktop.
Android のチャットUIライブラリを作ってみた ref: http://qiita.com/bassaer/items/f92d671ca036d526d2b1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<jp.bassaer.chatmessageview.MessageView | |
android:id="@+id/message_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"/> | |
</LinearLayout> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
messageView.init(messages); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Bitmap icon1 = BitmapFactory.decodeResource(getResources(), jp.bassaer.chatmessageview.R.drawable.face_1); | |
Message message1 = new Message(); | |
message1.setUserIcon(icon1); | |
message1.setUserName("Michael"); | |
message1.setMessageText("hey! how are you?"); | |
message1.setRightMessage(true); | |
ArrayList<Message> messages = new ArrayList<>(); | |
messages.add(message1); | |
MessageView messageView = (MessageView) findViewById(R.id.message_view); | |
messageView.init(messages); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment