Код: Выделить всё
<?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"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/stations"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="TextView"
android:layout_weight="0.5"
android:gravity="center_horizontal"/>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_weight="0"
android:src="@drawable/common_signin_btn_icon_dark" />
<TextView
android:id="@+id/stations2"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="TextView"
android:layout_weight="0.5"
android:gravity="center_horizontal"/>
</LinearLayout>
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"
android:scrollbars="none" >
</ListView>
</LinearLayout>
public class ProductsDay extends ListFragment{
public class ProductsAdapter extends ArrayAdapter<String> {
Context myContext;
ListView listView;
public ProductsAdapter(Context context, int textViewResourceId,
String[] objects) {
super(context, textViewResourceId, objects);
myContext = context;}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater =
(LayoutInflater)myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row=inflater.inflate(R.layout.text_fragment, parent, false);
TextView text=(TextView) findViewById(R.id.text);
ray.setText("Распродажа");
ImageView imgView = (ImageView) findViewById(R.id.image);
imgView.setImageResource(R.drawable.right);
TextView text2=(TextView) findViewById(R.id.text2);
ray1.setText("Поступление");
return row;}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ProductsAdapter myListAdapter = new ProductsAdapter(getActivity(), R.layout.text_fragment, times);
setListAdapter(myListAdapter); }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { return inflater.inflate(R.layout.listview, container, false);}
}
public class ProductsEnd extends ListFragment{
public class ProductsAdapter extends ArrayAdapter<String> {
Context myContext;
ListView listView;
public ProductsAdapter(Context context, int textViewResourceId,
String[] objects) {
super(context, textViewResourceId, objects);
myContext = context;}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater =
(LayoutInflater)myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row=inflater.inflate(R.layout.text_fragment, parent, false);
TextView ray=(TextView)row.findViewById(R.id.text);
ray.setText("Распродажа");
ImageView imgView = (ImageView) row.findViewById(R.id.image);
imgView.setImageResource(R.drawable.right);
TextView ray1=(TextView)findViewById(R.id.text2);
ray1.setText("Поступление");
return row;}}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ProductsAdapter myListAdapter = new ProductsAdapter(getActivity(), R.layout.text_fragment, times);
setListAdapter(myListAdapter);}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.listview, container, false);}
}