I'm having trouble designing a Activity.
I'm trying to use a Mvx.MvxBindableLinearLayout, making bind to a list: A, B and c;
When I do this binding, the result is:
A
B
C
C
B
A
The correct would be:
A
B
C
The code in question is:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/m2uMobileSales.Droid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/m2uMobileSales.Droid"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:showDividers="none"
android:layout_weight="1">
<include
layout="#layout/PageCommon_Titlebar" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tableLayout1"
android:divider="#null"
android:dividerHeight="0dp"
android:stretchColumns="1">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tableLayout1"
android:stretchColumns="1">
<!--Customer Name-->
<TextView
android:id="#+id/CustomerName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
android:layout_weight="1"
local:MvxBind="{'Text':{'Path':'Customer.CustDetails.Name','Mode':'OneWay'}}" />
</TableRow>
<TableRow>
<!--Detail Pages android:padding="12dp" -->
<Mvx.MvxBindableLinearLayout
android:padding="3dip"
android:id="#+id/ClienteDetails"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#null"
android:dividerHeight="0dp"
android:orientation="vertical"
android:cacheColorHint="#00000000"
android:layout_weight="1"
local:MvxItemTemplate="#layout/listitem_clientdetailpages"
local:MvxBind="{'ItemsSource':{'Path':'DetailPageViewModels'}}"/>
<!--<Mvx.MvxBindableListView
android:id="#+id/ClienteDetails"
android:divider="#null"
android:dividerHeight="0dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:cacheColorHint="#00000000"
android:layout_weight="1"
local:MvxItemTemplate="#layout/listitem_clientdetailpages"
local:MvxBind="{'ItemsSource':{'Path':'DetailPageViewModels', 'Mode':'OneWay'}}" />-->
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
If I use commented Mvx.MvxBindableListView, I can only see the first item.
The objective is scroll all the elements and not the list, doing as the definitions of android.
After overcoming this problem, I will have a list within a list (DetailPageViewModels will have several elements including a list).
I've seen several posts that advise inserting all elements inside a ScrollView.
I tried comment Mvx.MvxBindableLinearLayout, ScrollView and MvxBindableListView worked well. If I use ScrollView I only see the first element.
My objective is use MvxBindableLinearLayout, because I need scroll the entire page, and and non elements.
listitem_clientdetailpages code:
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/m2uMobileSales.Droid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="none"
android:layout_weight="1">
<!--Page Title-->
<TextView
android:id="#+id/detailpagetitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="24dp"
android:padding="3dip"
local:MvxBind="{'Text':{'Path':'Title','Mode':'OneWay'}}" >
</TextView>
</LinearLayout>
I apologize for the confusion.
Thanks for the help and availability.
I just tried in v3 and this code worked as expected:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/com.cirrious.dailydilbert"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Mvx.MvxLinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
local:MvxBind="ItemsSource Items;ItemClick ItemSelectedCommand"
local:MvxItemTemplate="#layout/listitem_dilbert" />
</ScrollView>
I can't really see any problems in the LinearLayout for the code you've posted. It might help if I could see the template for the list item, and the viewmodel list itself. If you think there's a bug, then please post a simple reproduction somewhere and I'll look at it - the more full that reproduction the quicker I can look at it - i.e. ideally post a full solution on a github repo - I can just download and run it then.
For the bindable ListView I'd be a bit suspicious of the attribute android:layout_height="wrap_content" - suspect that might not work properly.
Update, I also tried in the Tutorial app, replacing the ListView with a LinearLayout in Page_MainMenuView.axml :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/Tutorial.UI.Droid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Mvx.MvxLinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
local:MvxBind="ItemsSource Items;ItemClick ShowItemCommand"
local:MvxItemTemplate="#layout/listitem_viewmodel"
/>
</ScrollView>
This displays perfectly - does this work also in your setup?
If it does, then the problem must be somewhere in the code you're not including...
I'm a coworker of Paulo Dias and we've just figured out what's happening...
The problem is in the creation of the MvxBindableLinearLayout
In the constructor we have
Adapter = new MvxBindableListAdapterWithChangedEvent(context);
Adapter.DataSetChanged += AdapterOnDataSetChanged;
And in the 'Set' of the property 'Adapter' we have
var existing = _adapter;
if (existing == value)
return;
if (existing != null && value != null)
{
existing.DataSetChanged -= AdapterOnDataSetChanged;
value.ItemsSource = existing.ItemsSource;
value.ItemTemplateId = existing.ItemTemplateId;
}
if (value != null)
{
value.DataSetChanged += AdapterOnDataSetChanged;
}
The first time the Adapter is created, the DataSetChanged event is subscribed two times (in the constructor and in the set of the adapter property).
This can be a problem if we have a notifiable collection binded to the MvxBindableLinearLayout.
Now the tricky part... This bug only 'reveals himself' when we do changes in the binded list after the ui control is created (i.e. add new items to the list). If we have a list in the viewmodel that is 'setted in the constructor' and then is never changed, the DataSetChanged event will never be fired. On the other hand, if we add items after the ui is created (i.e. you can have a command binded to a button, that adds items to the list), the items will be duplicated in the ui...
To solve this, we´ve just commented the line in the MvxBindableLinearLayout contructor where the DataSetChanged` is beeing subscribed, and all falls back to place :)
public MvxBindableLinearLayout(Context context, IAttributeSet attrs)
: base(context, attrs)
{
var itemTemplateId = MvxBindableListViewHelpers.ReadAttributeValue(context, attrs,
MvxAndroidBindingResource.Instance
.BindableListViewStylableGroupId,
MvxAndroidBindingResource.Instance
.BindableListItemTemplateId);
Adapter = new MvxBindableListAdapterWithChangedEvent(context);
Adapter.ItemTemplateId = itemTemplateId;
//Adapter.DataSetChanged += AdapterOnDataSetChanged;
this.ChildViewRemoved += OnChildViewRemoved;
}
Hope this can help!
ps: Wondering why anyone didn't had this problem before...
ps1: We are currently using MvvmCross vNext.
ps2: I've changed to Mvvmcross V3, and the problem persists. I'll make a request in Github
Related
I pulled this section of code from: https://github.com/slodge/MvvmCross-Tutorials/blob/master/MoreControls/MoreControls.Droid/Resources/Layout/FirstView.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxSpinner
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
local:MvxBind="ItemsSource Shapes; SelectedItem Current" />
<!--
could be customised using
local:MvxDropDownItemTemplate="#layout/spinner_dropdownitem_shape"
local:MvxItemTemplate="#layout/spinner_item_shape"
-->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Current" />
<MC.ShapeView
android:layout_width="fill_parent"
android:layout_height="300dp"
local:MvxBind="Shape Current" />
</LinearLayout>
The comment mentions it is possible to customize the look by passing MvxDropDownItemTemplate and MvxItemTemplate a layout. Let's assume we are going to use this simple layout for both templates:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/Project.Ui.Droid"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:MvxBind="Text ???????" />
</FrameLayout>
The MvxSpinner displays the enumerated name (Circle, Square, Triangle) as the text for each item. Without changing the view model, is it possible to create a binding, in the template, that displays the same thing the MvxSpinner displays by default when no template is used? If so, what would that binding look like? If that's not possible, what is the best way to accomplish this outcome?
in the template, that displays the same thing the MvxSpinner displays by default when no template is used? If so, what would that binding look like? If that's not possible, what is the best way to accomplish this outcome?
The default template uses ToString() on the object.
To achieve the same thing, you can use the Whole Object binding. From the wiki, you should be able to specify using an empty Path or a single Period for the Path. Since we've seen some issues reported recently with empty Path binding, I recommend using a Period:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/Project.Ui.Droid"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:MvxBind="Text ." />
</FrameLayout>
I have an activity with the associated activity.xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/pattern_background"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:clickable="false" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
...
<LinearLayout
android:id="#+id/llComments"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
</ScrollView>
<include
android:id="#+id/layoutComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="#layout/widget_comentarios_fragment" >
</include>
In the LinearLayout with id llComments I introduce a fragment called CommentsFragment dynamically from the activity with the following code:
private Fragment commentsFragment;
private FragmentTransaction ft;
...
llComentarios = (LinearLayout) findViewById(R.id.llComments);
...
Bundle args = new Bundle();
args.putString(Constants.IDMODEL, getId());
commentsFragment = CommentsFragment.newInstance(args);
ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.llComments, commentsFragment).commit();
The Fragment associated xml file is:
<?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"
android:orientation="vertical">
<ListView
android:id="#+id/comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#color/transparent"
android:dividerHeight="10dp"
android:paddingLeft="#dimen/indicator_internal_padding"
android:paddingRight="#dimen/indicator_internal_padding" />
</LinearLayout>
The problem I cannot solve is to show in the activity more than one item (in fact I am showing one and a third items) in the list if I do not fix a height for the listview.It should adapt to as many items I add to the list in the fragment through the adapter. I have tried different combinations of heights in the layouts and views, but still does not work. Maybe I am annulating one with other.
Any help would be appreciated.
Thanks in advance
After some days I find out the exact problem. I was including a ListView into a ScrollView, and that's clearly not recomended by Android developers.
You can look for further info here: Why ListView cannot be used in a ScrollView?
Anyway, if you want to do it, you can do that with a hack. Take a look at these proposals:
How can I put a ListView into a ScrollView without it collapsing?
For me that worked. Problem solved.
I have implemented a ListView in my application using a custom implementation of CursorAdapter. My problem is, that whenever I fling to scroll quickly to the bottom of the list (right after launching the application), I sometimes end up with all the ListView items drawn overlapping each other. If I scroll back up or touch one of the items, they become properly arranged.
Here is how it looks after I quickly scroll down :
http://i.stack.imgur.com/cTcfD.png
Here is how it looks when I am select-ing one of the items :
http://i.stack.imgur.com/ZTRSt.png
Here is the XML for my ListView :
<ListView
android:id="#+id/all_reminders_list"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_alignParentLeft="true"
android:clickable="true"
android:dividerHeight="1.0sp"
android:animateLayoutChanges="true">
Here's the newView(..) method of my custom CursorAdapter :
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View view = inflater.inflate(R.layout.view_list_item, parent, false);
return view;
}
And this is the bindView(..) method :
public void bindView(View view, Context context, Cursor cursor) {
TextView whatTextView = (TextView) view.findViewById(R.id.item_what_text);
whatTextView.setText(cursor.getString(1));
TextView whenTextView = (TextView) view.findViewById(R.id.item_when_text);
if(cursor.getInt(9) != 0) // DONE_FLAG = 1 (completed)
{
//Arrow visibility
ImageView arrow = (ImageView)view.findViewById(R.id.list_item_arrow);
arrow.setVisibility(View.INVISIBLE);
//Text color
whatTextView.setTextColor(Color.LTGRAY);
whenTextView.setTextColor(Color.LTGRAY);
//WHEN text
whenTextView.setText(TimeCalculationHelper.getCompletedTimeString(cursor.getLong(2)));
}
else // DONE_FLAG = 0
{
//Arrow visibility
ImageView arrow = (ImageView)view.findViewById(R.id.list_item_arrow);
arrow.setVisibility(View.VISIBLE);
//Text color
whatTextView.setTextColor(Color.BLACK);
whenTextView.setTextColor(Color.BLACK);
//WHEN text
whenTextView.setText(TimeCalculationHelper.getTimeRemainingString(cursor.getLong(2)));
}
}
I've also noticed that I have been able to replicate it only when my device (Galaxy S2) is in power saving mode. Is there something I should be doing differently here? Thanks in advance!
EDIT : Including the list item's layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="2dp">
<TextView android:id="#+id/item_what_text"
android:lines="1"
android:maxLines="2"
android:textSize="22dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="3dp"/>
<TextView android:id="#+id/item_when_text"
android:lines="1"
android:maxLines="1"
android:textSize="14dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13 minutes"
android:paddingBottom="2dp"
android:layout_below="#+id/item_what_text"/>
<ImageView
android:id="#+id/list_item_arrow"
android:src="#drawable/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
I also faced the same problem, with List items in my ListView overlapping each other whilst scrolling.
My fix:
I just specified a background for the parent layout that contained the ListView in question. Previously it was transparent.
I had the same problem and found it was caused by setting the animateLayoutChanges attribute to true on the listview.
Unfortunately I lose the animation of the listview by removing it but at least it draws properly when scrolling fast.
Giving the parent layout a background also appears to fix the issue, as mentioned by Pavan. Will experiment and change my answer if I discover issues with the background change.
For solving this ,i have one more solution:
I faced problem by using this layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:paddingTop="4dip"
android:dividerHeight="0dp"
android:divider="#null"
android:cacheColorHint="#00000000"
android:listSelector="#color/transprent_editbox"
android:focusableInTouchMode="false" />
</RelativeLayout>
In order to solve that Problem,i just did few modifications on Above layout,those are:
1)Changed top layout from Relative to Linear Layout.
2)Put my ListView in other Relative Layout ..
i did like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:paddingTop="4dip"
android:dividerHeight="0dp"
android:divider="#null"
android:cacheColorHint="#00000000"
android:listSelector="#color/transprent_editbox"
android:focusableInTouchMode="false" />
</RelativeLayout>
</LinearLayout>
After using this,my problem is solved.
1.
in my opinion, height is wrap_content
because listview is restore row
2.
other opinion is write this code android:cacheColorHint="#00000000" in ListView
I also faced the same problem and found that animateLayoutChanges attribute causing the problems.
So i changed
android:animateLayoutChanges="true"
to
android:animateLayoutChanges="false"
and it worked.
I am using following layout for my list view items.
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://scheme.android.com/apk/res/android"
android:id="#+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="10dip"
android:textSize="18sp"
android:minHeight="40sp"
/>
But I am getting an error in the logcat java.lang.RuntimeException ... that you must supply a layout_width argument.
My main.xml is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/widget28"
android:background="#ff000033"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="70px"
android:layout_height="30px"
android:paddingLeft="2px"
android:paddingTop="2px"
android:background="#drawable/ic_launcher"
></ImageView>
<ListView
android:id="#+id/myListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
and this is my activity's onCreate code
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
context=this.getApplicationContext();
this.setTitle("NP Headline News");
myListView=(ListView)findViewById(R.id.myListView);
myListView.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> arg0, View v, int index,long id) {
// TODO Auto-generated method stub
String urlAddress=urlAddresses[index];
String urlCaption = urlsCaptions[index];
}
});
int layoutId=R.layout.simple_list_item_1;
// int layoutId=android.R.layout.simple_list_item_1;
aa = new ArrayAdapter<String>(this,layoutId,this.urlsCaptions);
myListView.setAdapter(aa);
}
I think that it is something related to my simple_list_item_1 because if I use android.R.layout.simple_list_item_1 then every thing works ok
Here is your error cleared layout:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="10dip"
android:textSize="18sp"
android:minHeight="40sp"
/>
Can you able to differentiate your error contained code and this above one.
I wish you guys to don't tense and urge while code something, that must be lead you to blocked and confused minded.
For these type of errors, you could use to debug yourself with the help of DDMS.
Because the code is very very simple to view right.
And some words about the previous answers:
Guys that is not necessary to declare a TextView or any View only inside of the Layout file.
It is also a View, So it can capable to sit alone in a Canvas.
And also the problem is not by the "fill_parent", and "match_parent" Something.
I think you might be tensed now also, because i am taking this much time to give you the reason of your error.
Here we go,
the error is because simply in the following line,
xmlns:android="http://schemas.android.com/apk/res/android"
In the above line you mistakenly typed scheme instead of schemas.
That is the error.
So only i mentioned if you had look at the code with out tense you can get it easily.
xmlns denotes the namespace , that should be proper in order make the android: prefixed attributes as valuable.
Hope you understand and the answer helpful to you.
YOU should puy your TextView under a Layout, since your are using a unique TextView you could add a LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView xmlns:android="http://scheme.android.com/apk/res/android"
android:id="#+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="10dip"
android:textSize="18sp"
android:minHeight="40sp"
/>
</LinearLayout>
I guess problem comes from something different.
You are doing a custom item view, but you use standard AdapterView.
For a standard arrayAdapter you need to fulfil the expected structure.
Alternatively you build an own ArrayAdapter and supply your dedicated getView
Android Custom Listview
I have trouble accessing Views from a layout that is included in another layout.
Please take a look at this picture:
http://dl.dropbox.com/u/3473245/layout_includes.png
How do I access the 4 text views programmatically?
Its probably something really simple that I'm missing.
Thank you very much!
You can do as follows:
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<include android:id="#+id/item_base_lang" layout="#layout/dictionary_list_item" />
<include android:id="#+id/item_learn_lang" layout="#layout/dictionary_list_item" />
</LinearLayout>
dictionary_list_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/dictionary_list_item_text_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/dictionary_list_item_text_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
To set the text programmatically:
((TextView)findViewById(R.id.item_base_lang).findViewById(R.id.dictionary_list_item_text_header)).setText("item_base_lang_header");
((TextView)findViewById(R.id.item_base_lang).findViewById(R.id.dictionary_list_item_text_content)).setText("item_base_lang_content");
((TextView)findViewById(R.id.item_learn_lang).findViewById(R.id.dictionary_list_item_text_header)).setText("item_learn_lang_header");
((TextView)findViewById(R.id.item_learn_lang).findViewById(R.id.dictionary_list_item_text_content)).setText("item_learn_lang_content");
This Android wiki page shows how to use reusable UI components with XML layouts, but it doesn't show how to access nested reusable components from code.
Although it is fairly straightforward, it might be not so clear for those who are pretty new to Android Views.
The following two lines should help you get the languageHeader of both includes. You can do the same for languageText
findViewByid(R.id.activityBaseLangView).findViewById(R.id.languageHeader)
findViewByid(R.id.activityLearnLangView).findViewById(R.id.languageHeader)