android - ConstraintLayout TextView is not shown -


i got following problem in constraintlayout

layout file:

<?xml version="1.0" encoding="utf-8"?> <linearlayout 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"               android:layout_width="match_parent"               android:layout_height="wrap_content"               android:background="@color/colorprimary"               android:minheight="?android:attr/actionbarsize"               android:orientation="horizontal"               android:paddingend="8dp">      <android.support.constraint.constraintlayout         android:id="@+id/layout_titlemode"         android:layout_width="match_parent"         android:layout_height="match_parent">          <textview             android:id="@+id/textview_title"             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_marginbottom="8dp"             android:layout_marginleft="32dp"             android:layout_marginright="32dp"             android:layout_margintop="8dp"             android:text="textview"             android:textalignment="center"             android:textcolor="@color/colorunactive"             app:layout_constraintbottom_tobottomof="parent"             app:layout_constraintleft_toleftof="parent"             app:layout_constraintright_torightof="parent"             app:layout_constrainttop_totopof="parent"             app:layout_constraintvertical_bias="0.5"/>     </android.support.constraint.constraintlayout> </linearlayout> 


styles (using apptheme):

<resources> <style name="apptheme" parent="theme.multibackstack">         <item name="android:textcolorprimary">@color/colortextprimary</item>     </style>      <style name="theme.multibackstack" parent="theme.appcompat.light.darkactionbar">         <item name="colorprimary">@color/colorprimary</item>         <item name="colorprimarydark">@color/colorprimary</item> <item name="android:textcolorprimary">@color/colortextprimary</item>     </style> </resources> 


this expected due preview: design screenshot

i excepted textview take available space (like match_parent) , text shown in center of view.


this shown: actually shown content
instead, nothing shown (i guess because of layout_width="0dp")

the newest version of constraint support library added: 'com.android.support.constraint:constraint-layout:1.0.2'


what tried in addition:
added textview app:layout_constraintwidth_default="wrap" let textview shown up, starts on left , not centered. how can achieve center view ?



can't determine why nothing shown. thank in advance helping!

try using theme.

<style name="apptheme" parent="theme.appcompat.light">         <!-- customize theme here. -->         <item name="colorprimary">@color/colorprimary</item>         <item name="coloraccent">@color/coloraccent</item>         <item name="colorprimarydark">@color/colorprimaryd</item>      </style> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -