title: Text is not visible when i used a custom drawable layout as a background. my all code is down here
body: <p>Dont read this starting few lines
  it keeps saying your post is mostly code please add description...dont know what to write in it ... i already posted all the relevant content associated with my error.. please help me</p>
  
  <p>MessageAdapter.java (ADAPTER CLASS)</p>
  
  <pre><code> public class MessageAdapter extends RecyclerView.Adapter&lt;MessageAdapter.MessageViewHolder&gt;{
      private List&lt;Messages&gt; mMessageList;
      private FirebaseAuth mAuth;
      public MessageAdapter(List&lt;Messages&gt; mMessageList) {this.mMessageList=mMessageList;
      }
  
      @Override
      public 
      MessageAdapter.MessageViewHolder onCreateViewHolder(ViewGroup parent,int viewType) {
          View v= LayoutInflater.from(parent.getContext())
          .inflate(R.layout.message_single_layout,parent,false);
          return new MessageAdapter.MessageViewHolder(v);
      }
  
      public class MessageViewHolder extends RecyclerView.ViewHolder{
  
          public TextView messageText;
          public CircleImageView profileImage;
  
          public MessageViewHolder(View view){
              super(view);
              messageText=(TextView)view.findViewById(R.id.message_text_layout);
              profileImage=
          (CircleImageView) view.findViewById(R.id.message_profile_layout);
          }
      }
  
      @Override
      public void onBindViewHolder(MessageViewHolder holder, int position) {
  
          mAuth=FirebaseAuth.getInstance();
  
          String currentUserId=mAuth.getCurrentUser().getUid();
          Messages c=mMessageList.get(position);
  
          String from_user=c.getFrom();
          if (from_user.equals(currentUserId)){
  
              holder.messageText.setBackgroundColor(Color.WHITE);
              holder.messageText.setTextColor(Color.BLACK);
  
          }else {
                                                                                                               holder.messageText.
  setBackgroundResource(R.drawable.message_text_background);
              holder.messageText.setTextColor(Color.WHITE);
  
          }
          holder.messageText.setText(c.getMessage());
  
      }
  
      @Override
      public int getItemCount() {
          return mMessageList.size();
      }
      }
  </code></pre>
  
  <p>Messages.java (MODEL CLASS)</p>
  
  <pre><code> public class Messages {
  
  
      private String message,type,from;
      private long time;
      private Boolean seen;
  
      public Messages(String from){
          this.from=from;
      }
  
      public Messages(String message,boolean seen,long time,String type){
  
          this.message= message;
          this.seen=seen;
          this.time=time;
          this.type=type;
  
      }
  
      public String getMessage() {return message;}
  
      public void setMessage(String message) {this.message = message;}
  
      public boolean getSeen() {return seen;}
  
      public void setSeen(Boolean seen) {this.seen = seen;}
  
      public long getTime() {return time;}
  
      public void setTime(long time) {this.time = time;}
  
      public String getType() {return type;}
  
      public void setType(String type) {this.type = type;}
  
      public String getFrom() {
          return from;
      }
  
      public void setFrom(String from) {
          this.from = from;
      }
  
      public Messages(){
  
      }
      }
  </code></pre>
  
  <p>ChatActivity.java(MAIN CLASS)</p>
  
  <pre><code>public class ChatActivity extends AppCompatActivity{
  
  private String mChatUser;
  
  private String mChatUsername;
  
  private Toolbar mChatToolbar;
  
  private DatabaseReference mRootRef;
  
  private TextView mTitleView;
  private TextView mLastSeenView;
  private CircleImageView mProfileImage;
  
  private FirebaseAuth mAuth;
  
  String mCurrentUserId;
  
  private ImageButton mChatAddBtn;
  private ImageButton mChatSendBtn;
  private EditText mChatMessageView;
  
  private RecyclerView mMessagesList;
  
  private final List&lt;Messages&gt; messagesList=new ArrayList&lt;&gt;();
  
  private LinearLayoutManager mLinearLayout;
  
  private MessageAdapter mAdapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_chat);
  
      mChatToolbar=(Toolbar)findViewById(R.id.chat_app_bar);
      mAuth=FirebaseAuth.getInstance();
      mCurrentUserId=mAuth.getUid();
  
  
      setSupportActionBar(mChatToolbar);
      ActionBar actionBar=getSupportActionBar();
      actionBar.setDisplayHomeAsUpEnabled(true);
      actionBar.setDisplayShowCustomEnabled(true);
  
      mRootRef= FirebaseDatabase.getInstance().getReference();
  
  
      mChatUser=getIntent().getStringExtra("user_id");
      mChatUsername=getIntent().getStringExtra("user_name");
  
  
      LayoutInflater inflater=(LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View actionBarView= inflater.inflate(R.layout.chat_custom_bar,null);
  
      actionBar.setCustomView(actionBarView);
  
      mTitleView=(TextView)findViewById(R.id.custom_bar_title);
      mLastSeenView=(TextView)findViewById(R.id.custom_bar_seen);
      mProfileImage=(CircleImageView)findViewById(R.id.custom_bar_image);
  
      mChatAddBtn=(ImageButton) findViewById(R.id.chat_add_btn);
      mChatSendBtn=(ImageButton) findViewById(R.id.chat_send_btn);
      mChatMessageView=(EditText)findViewById(R.id.chat_message_view);
  
      mAdapter=new MessageAdapter(messagesList);
  
      mMessagesList=(RecyclerView)findViewById(R.id.messages_list);
  
      mLinearLayout=new LinearLayoutManager(this);
      mMessagesList.setHasFixedSize(true);
  
      mMessagesList.setLayoutManager(mLinearLayout);
  
      mMessagesList.setAdapter(mAdapter);
  
      loadMessages();
  
  
      mTitleView.setText(mChatUsername);
  
      mRootRef.child("users").child(mChatUser).addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              String online=dataSnapshot.child("online").getValue().toString();
              String image=dataSnapshot.child("image").getValue().toString();
  
  
              if (online.equals("true")){
                  mLastSeenView.setText("online");
              }else
              {
                  GetTimeAgo getTimeAgo=new GetTimeAgo();
                  long lastTime=Long.parseLong(online);
                  String lastSeenTime = getTimeAgo.getTimeAgo(lastTime,getApplicationContext());
                  mLastSeenView.setText(lastSeenTime);
              }
  
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
  
          }
      });
  
      mRootRef.child("chat").child(mCurrentUserId).addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              if (!dataSnapshot.hasChild(mChatUser)){
  
                  Map chatAddMap=new HashMap();
                  chatAddMap.put("seen",false);
                  chatAddMap.put("timestamp", ServerValue.TIMESTAMP);
  
                  Map chatUserMap=new HashMap();
                  chatUserMap.put("chat/"+mCurrentUserId+"/"+mChatUser,chatAddMap);
                  chatUserMap.put("chat/"+mChatUser+"/"+mCurrentUserId,chatAddMap);
  
                  mRootRef.updateChildren(chatUserMap, new DatabaseReference.CompletionListener() {
                      @Override
                      public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
  
                      }
                  });
  
              }
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
  
          }
      });
  
      mChatSendBtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              sendMessage();
          }
      });
  
  
  
  }
  
  private void loadMessages() {
  
      mRootRef.child("messages").child(mCurrentUserId).child(mChatUser).addChildEventListener(new ChildEventListener() {
          @Override
          public void onChildAdded(DataSnapshot dataSnapshot, String s) {
  
              Messages message = dataSnapshot.getValue(Messages.class);
              messagesList.add(message);
              mAdapter.notifyDataSetChanged();
  
  
  
          }
  
          @Override
          public void onChildChanged(DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onChildRemoved(DataSnapshot dataSnapshot) {
  
          }
  
          @Override
          public void onChildMoved(DataSnapshot dataSnapshot, String s) {
  
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
  
          }
      });
  
  
  }
  
  private void sendMessage() {
  
      String message= mChatMessageView.getText().toString();
      if (!TextUtils.isEmpty(message)){
          String current_user_ref="messages/"+mCurrentUserId+"/"+mChatUser;
          String chat_user_ref="messages/"+mChatUser+"/"+mCurrentUserId;
  
          DatabaseReference user_message_push=mRootRef.child("messages").child(mCurrentUserId).child(mChatUser).push();
  
          String push_id=user_message_push.getKey();
  
          Map messageMap=new HashMap();
          messageMap.put("messages",message);
          messageMap.put("seen",false);
          messageMap.put("type","text");
          messageMap.put("time",ServerValue.TIMESTAMP);
          messageMap.put("from",mCurrentUserId);
  
          Map messageUserMap= new HashMap();
          messageUserMap.put(current_user_ref+"/"+push_id,messageMap);
          messageUserMap.put(chat_user_ref+"/"+push_id,messageMap);
  
          mChatMessageView.setText("");
  
          mRootRef.updateChildren(messageUserMap, new DatabaseReference.CompletionListener() {
              @Override
              public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
                  if (databaseError!=null){
                      Log.d("chat_log",databaseError.getMessage().toString());
                  }
              }
          });
  
  
  
  
      }
  }
  }
  </code></pre>
  
  <p>MessageLayout.xml (SINGLE MESSAGE LAYOUT)</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/message_single_layout"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:padding="10dp"&gt;
  
  &lt;de.hdodenhof.circleimageview.CircleImageView
      android:id="@+id/message_profile_layout"
      android:layout_width="56dp"
      android:layout_height="56dp"
      android:src="@drawable/avatar" /&gt;
  
  &lt;TextView
      android:id="@+id/message_text_layout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_marginStart="11dp"
      android:layout_toEndOf="@+id/message_profile_layout"
      android:background="@drawable/message_text_background"
      android:padding="15dp"
      android:text="TextView"
      android:textColor="#ffffff"
      android:textSize="14sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>MessageTextBackground.xml(SHAPE XML MESSAGE BACKGROUND)</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;solid android:color="@color/colorPrimary"/&gt;
  &lt;corners android:radius="30dp"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/rcVsm.png" rel="nofollow noreferrer">Text is Not visible in chat. I used a custom background layout . code is attached above</a></p>