mardi 28 octobre 2014

android how to get attribute values from xml file?


Vote count:

0




Consider this layout:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/tab_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="HELLO AGAIN"
android:textSize="15sp"
/>
</LinearLayout>


now this is some part of google tab code which after getting my layout and texview id do following:



TextView tabTitleView = null;

if (mTabViewLayoutId != 0) {
// If there is a custom tab view layout id set, try and inflate it
tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
false);
tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
}


my problem is why tabTitleView dose not use the xml values of my tab_text? for example it dose not use red background if i set that value in that xml file or it dose not use font size and ... and how to force it uses those value because I have multiple layouts I do not want to do it programmatically.


and in the main activity what i have done to set the custom view is:



mSlidingTabLayout = (SlidingTabLayout)findViewById(R.id.tabs);
mSlidingTabLayout.setCustomTabView(R.layout.tab_custom_layout, R.id.tab_text);


really need your help?



asked 49 secs ago

mmlooloo

3,340






android how to get attribute values from xml file?

Aucun commentaire:

Enregistrer un commentaire