erdomester
Newbie
Hi guys,
I've been looking for the solution of my problem for a while.
I have an app.
Config.xml has some buttons and a listview. This is the listview:
In the ListView i created two TextViews. For this i am using another xml, called row.xml:
So these two TextViews are like columns in the ListView.
I manage config.xml in MainActivity.java: button listeners etc. In case of a button listener i want to change the width of one of the TextViews in the ListView, but i can't.
I cannot use txt1.setWidth(60) as the TextView is in row.xml, while the button is in config.xml. I tried to do it by using RemoteViews, it didn't work, and i don't know if i can use RemoteViews here.
So basically the
is wrong as it makes Android look for the TextView in config.xml.
Any ideas?
I've been looking for the solution of my problem for a while.
I have an app.
Config.xml has some buttons and a listview. This is the listview:
Code:
<ListView android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/linlay">
</ListView>
In the ListView i created two TextViews. For this i am using another xml, called row.xml:
Code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/linlay0">
<LinearLayout android:orientation="horizontal"
android:id="@+id/linlay"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/left"
android:layout_width="160px"
android:layout_height="wrap_content"
android:textColor="#FF0000"
android:paddingLeft="5px"/>
<TextView android:id="@+id/right"
android:layout_width="140px"
android:layout_height="wrap_content"
android:maxWidth="140px"
android:singleLine="false"/>
</LinearLayout>
</LinearLayout>
So these two TextViews are like columns in the ListView.
I manage config.xml in MainActivity.java: button listeners etc. In case of a button listener i want to change the width of one of the TextViews in the ListView, but i can't.
Code:
txt1 = (TextView) findViewById(R.id.left);
txt2 = (TextView) findViewById(R.id.right);
Button sortdate = (Button)findViewById(R.id.Button01);
sortdate.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
lv1.setAdapter(simpleAdapter);
//here
}
});
I cannot use txt1.setWidth(60) as the TextView is in row.xml, while the button is in config.xml. I tried to do it by using RemoteViews, it didn't work, and i don't know if i can use RemoteViews here.
So basically the
Code:
txt1 = (TextView) findViewById(R.id.left);
Any ideas?