I implemented my own navigation drawer that comes from the left screen in my android application. The problem is that the ListView it is not visible and I can't figure out why.
This is the method onCreateView of the fragment where the list is (first I initialize the header of the layout and then the list with my custom adapter):
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View firstAccessView = inflater.inflate(R.layout.fragment_navigation_drawer, null);
this.profileImageDrawer = (ImageView) firstAccessView.findViewById(R.id.imageViewProfileDrawer);
RoundImage roundedImage = new RoundImage(BitmapFactory.decodeResource(getResources(), R.mipmap.iconuseranonymous));
//this.profileImageDrawer.setImageDrawable(roundedImage);
Picasso.with((Activity) getActivity()).load("https://graph.facebook.com/" + Profile.getCurrentProfile().getId() + "/picture?height=105&width=105")
.placeholder(roundedImage)
.transform(new CircleTransform()).fit().centerCrop().into(this.profileImageDrawer);
this.nameSurnameDrawer = (TextView) firstAccessView.findViewById(R.id.textViewDrawner);
this.nameSurnameDrawer.setText(Profile.getCurrentProfile().getFirstName() + " " + Profile.getCurrentProfile().getLastName());
List<String> example = new ArrayList<String>();
example.add("Profile");
example.add("Ask");
example.add("Logout");
this.adapter = new DrawerAdapter(getActivity(), example);
list = (ListView) firstAccessView.findViewById(R.id.listDrawer);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
});
list.setItemChecked(mCurrentSelectedPosition,true);
return firstAccessView;
}
This is the code of my custom adapter
private Activity context;
private List<String> list;
private View view;
private TextView textView;
public DrawerAdapter(Activity context, List<String> list) {
super(context, R.layout.drawerlist_layout);
this.context=context;
this.list = list;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
view = inflater.inflate(R.layout.drawerlist_layout, null);
textView = (TextView) view.findViewById(R.id.sectionDrawer);
textView.setText(this.list.get(position));
textView.setTextColor(Color.BLACK);
return view;
}
and finally this is the layout of my fragment: at the top I have an header with an image and a TextView and then I have my custom ListView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="0.40"
android:background="#ffb200">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/imageViewProfileDrawer"
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="20px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Medium Text"
android:id="#+id/textViewDrawner"
android:layout_gravity="right|bottom"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff"
android:textStyle="bold"
android:textIsSelectable="true" />
</FrameLayout>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="262dp" android:choiceMode="singleChoice"
android:divider="#cecece" android:dividerHeight="1dp"
android:background="#FFFFFF"
tools:context="com.bellantoni.chetta.lieme.NavigationDrawerFragment"
android:id="#+id/listDrawer"
android:drawSelectorOnTop="false"
android:smoothScrollbar="true"
android:longClickable="false"
android:nestedScrollingEnabled="false"
android:footerDividersEnabled="false"
android:headerDividersEnabled="true"
android:paddingLeft="10dp"
android:stackFromBottom="false"
android:scrollingCache="false"
android:paddingRight="10dp"
android:textFilterEnabled="false"
android:theme="#style/Base.Widget.AppCompat.ActionMode"
android:textAlignment="center"
android:transitionGroup="true"
android:layout_weight="0.60" />
I found my error in this line of code:
super(context, R.layout.drawerlist_layout);
where I missed the third parameter which in this case is list so it should be
super(context, R.layout.drawerlist_layout,list);
Set both FameLayout and ListView layout_width to 0dp instead of match_parent if you want to use layout_weight.
Related
I'm trying to create listview programatically in android.
My goal is to create a dynamic view where if i click one button it will change the content inside the layout from listview into another view or vice versa.
Everything seems good i successfully put the listview inside a linear layout from the java file and i did that by creating a custom layout for the cell.
The problem is it shows the listview but it does not add the cell.
I know that it place the listview because the background become green when I run it but it does not show up the cell of the listview.
Am i missing something?
<?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="match_parent"
android:backgroundTint="#color/colorPrimary">
<TextView
android:id="#+id/listContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"/>
</RelativeLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
LinearLayout mainView,sideView;
ListView notelist;
String[] Names = {"great","good","average","great","good","average"};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mainView = (LinearLayout)findViewById(R.id.mainView);
notelist = new ListView(this);
notelist.setBackgroundColor(Color.GREEN);
CustomAdapter customAdapter = new CustomAdapter();
notelist.setAdapter(customAdapter);
notelist.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
mainView.addView(notelist);
}
class CustomAdapter extends BaseAdapter{
#Override
public int getCount() {
return Names.length;
}
#Override
public Object getItem(int position) {
return null;
}
#Override
public long getItemId(int position) {
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = getLayoutInflater().inflate(R.layout.list_vertical,null);
TextView contentText = (TextView) view.findViewById(R.id.listContent);
contentText.setText(Names[position]);
return null;
}
}
}
main xml
<?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="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<LinearLayout
android:id="#+id/sideView"
android:layout_weight=".20"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageButton
android:id="#+id/oneBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/noct"
/>
<ImageButton
android:id="#+id/twoBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/note"
/>
<ImageButton
android:id="#+id/threeBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/journal"
/>
<ImageButton
android:id="#+id/fourBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/mic"/>
<ImageButton
android:id="#+id/fiveBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/add"
/>
<ImageButton
android:id="#+id/sixBtn"
android:layout_width="#dimen/ButtonSize"
android:layout_height="#dimen/ButtonSize"
android:background="#android:color/transparent"
android:src="#drawable/pencil"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/mainView"
android:layout_weight=".80"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
Do not return null in getView
public View getView(int position, View convertView, ViewGroup parent) {
View view = getLayoutInflater().inflate(R.layout.list_vertical,null);
TextView contentText = (TextView) view.findViewById(R.id.listContent);
contentText.setText(Names[position]);
return view;
}
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.list_vertical,null);
TextView contentText = (TextView) convertView.findViewById(R.id.listContent);
contentText.setText(Names[position]);
return convertView;
}
I have a rather simple layout that I am intending on using for basic chat in a fragment, but scrolling through the ListView requires me to place one finger on the screen on an item in the ListView and then scroll up or down with another finger. I was under the impression that a ListView should only require a single finger/touch to be able to scroll. Is there something I am overlooking in my layout, adapter or even potentially the code I am using to populate the adapter with?
Chat Layout XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF" >
<ListView
android:id="#+id/msgListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/form"
android:divider="#null"
android:dividerHeight="0dp"
android:scrollbarSize="3dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:paddingBottom="10dp" />
<LinearLayout
android:id="#+id/form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#color/primary"
android:orientation="horizontal"
android:paddingBottom="2dp" >
<EditText
android:id="#+id/messageEditText"
android:layout_width="252dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignTop="#+id/button1"
android:layout_toLeftOf="#+id/sendMessageButton"
android:layout_weight="0.72"
android:ems="10"
android:maxHeight="80dp" />
<ImageButton
android:id="#+id/sendMessageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#drawable/chat_send_button" />
</LinearLayout>
</RelativeLayout>
ListView Adapter
public class ChatMessageAdapter extends BaseAdapter {
private static LayoutInflater inflater = null;
ArrayList<ChatMessage> chatMessageList;
public ChatMessageAdapter(Activity activity, ArrayList<ChatMessage> list) {
chatMessageList = list;
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return chatMessageList.size();
}
#Override
public Object getItem(int position) {
return position;
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ChatMessage message = chatMessageList.get(position);
View vi = convertView;
if (convertView == null)
vi = inflater.inflate(R.layout.chat_bubble, null);
TextView msg = (TextView) vi.findViewById(R.id.message_text);
msg.setText(message.body);
TextView dateTime = (TextView) vi.findViewById(R.id.msgDateTime);
dateTime.setText(message.dateTime);
LinearLayout layout = (LinearLayout) vi
.findViewById(R.id.bubble_layout);
LinearLayout parent_layout = (LinearLayout) vi
.findViewById(R.id.bubble_layout_parent);
// if message is mine then align to right
if (message.isMine) {
layout.setBackgroundResource(R.drawable.bubble2);
parent_layout.setGravity(Gravity.RIGHT);
}
// If not mine then align to left
else {
layout.setBackgroundResource(R.drawable.bubble1);
parent_layout.setGravity(Gravity.LEFT);
}
msg.setTextColor(Color.BLACK);
return vi;
}
public void add(ChatMessage object) {
chatMessageList.add(object);
}
}
I had the same problem!
If you're using the navigation drawer, in the app_bar_main.xml change the CoordinatorLayout for the NestedScrollView
and then in your fragment in the scrollView set android:nestedScrollingEnabled="true"
I'm trying to put a list view inside a fragment. I made tries and here is what I got (My app is working, but the list view simply doesn't appear.):
The Fragment I want the list in:
public class Trechos extends Fragment {
ListView list;
#Override
//Método para inflar o layout
public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle
savedInstanceState){
//Variável view to tipo View infla o layout a ser usado
View view = inflater.inflate(R.layout.trechos, container, false);
Classe classe = new Classe(getActivity());
list = (ListView) view.findViewById(R.id.list);
list.setAdapter(classe);
//retorna a variável view
return view;
}
}
The xml for the fragment:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
<ListView
android:id="#id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="adasdasds">
</ListView>
</LinearLayout>
The custom adapter I created to insert the informations:
public class Classe extends ArrayAdapter<String> {
private final Activity context;
private String [] trechos = {"a", "b"};
private int [] posicao = {1,2};
public Classe(Activity context) {
super(context, R.layout.row_layout);
this.context = context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rootView = inflater.inflate(R.layout.row_layout, null, true);
TextView txtPosicao = (TextView) rootView.findViewById(R.id.posicao);
TextView txtTrecho = (TextView) rootView.findViewById(R.id.trechos);
txtPosicao.setText(posicao[position]);
txtTrecho.setText(trechos[position]);
return rootView;
}
}
And the xml for the custom rows:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<TextView
android:textSize="20sp"
android:textStyle="bold"
android:padding="5dp"
android:id="#+id/posicao"
android:layout_width="50dp"
android:layout_height="50dp" />
<TextView
android:textStyle="italic"
android:textSize="20sp"
android:padding="5dp"
android:id="#+id/trechos"
android:layout_width="match_parent"
android:layout_height="50dp" />
</TableRow>
</TableLayout>
I want to have different background color of each item of listview. Following is my code for getView() method of custom adaptor.
public View getView(int position, View convertView, ViewGroup parent) {
convertView = mInflater.inflate(mViewResourceId, null);
View v = super.getView(position, convertView, parent);
RatingBar ratingBar = ((RatingBar)convertView.findViewById(R.id.my_choices_row_rating));
ratingBar.setRating(mRatings[position]);
TextView tv = (TextView)convertView.findViewById(R.id.my_choices_row_text);
tv.setText(mStrings[position]);
Log.v(TAG,"getView nalist=" + mNAList[position]);
Log.v(TAG,"getView gotlist=" + mGotList[position]);
if(mNAList[position].equalsIgnoreCase("N/A")){
TextView tv1 = (TextView)convertView.findViewById(R.id.my_choices_row_na_text);
tv1.setText(mNAList[position]);
}
if(mGotList[position].equalsIgnoreCase("Purchased")){
TextView tv2 = (TextView)convertView.findViewById(R.id.my_choices_row_got_text);
tv2.setText(mGotList[position]);
}
convertView.setBackgroundColor(mColors[position]);
return convertView;
}
}
Here is my xml file for the row of the list
<?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="wrap_content"
android:orientation="horizontal">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id = "#+id/RHE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="5dp"
android:layout_span = "3">
<TableRow android:layout_height="wrap_content">
<RatingBar
android:id="#+id/my_choices_row_rating"
android:progressDrawable="#drawable/hearts_rating_bar"
android:layout_width="fill_parent"
android:paddingTop="5dp"
android:layout_height="25sp"
android:numStars="5"
android:stepSize="1" />
<TextView
android:id="#+id/my_choices_row_text"
android:paddingLeft="2px"
android:paddingRight="2px"
android:paddingTop="2px"
android:textSize="18sp"
android:gravity="left|center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<CheckBox
android:id="#+id/my_choices_row_checkBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</TableRow>
<TableRow android:layout_height="wrap_content">
<TextView
android:id="#+id/my_choices_row_na_text"
android:textSize="12sp"
android:gravity="left|center"
android:textColor="#8B0000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/my_choices_row_got_text"
android:textSize="12sp"
android:textColor="#8B0000"
android:gravity="left"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
</LinearLayout>
I keep on getting following error
06-01 00:20:52.057: E/AndroidRuntime(711):FATAL EXCEPTION:main
06-01 00:20:52.057: E/AndroidRuntime(711):java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
06-01 00:20:52.057: E/AndroidRuntime(711):at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
Your tutorial
Ask me if there are anything you dont understant
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//your colors list
ArrayList<Integer> colors = new ArrayList<Integer>();
for(int i = 0; i < 10; i++){
Random ran = new Random();
int color = ran.nextInt();
colors.add(color);
}
//get listview and set adapter for it
ListView lv = (ListView) findViewById(R.id.myListView);
lv.setAdapter(new MyColorAdapter(this, colors));
}
public class MyColorAdapter extends ArrayAdapter<Integer>{
ArrayList<Integer> colors;
Context context;
public MyColorAdapter(Context context, ArrayList<Integer> colors) {
super(context, R.layout.row, colors);
this.colors = colors;
this.context = context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.row, parent, false);
rowView.setBackgroundColor(colors.get(position));
return rowView;
}
}
}
I'm having problems working with fragments. The problem is: I have a layout in my activity with a ListView. When i select an item in this ListView, instantiates a fragment replacing the activity layout. My result is both fragment and activity contents are showing on screen, overlaying each other. What can I fix that (the fragment just replacing the activity content)? Here is the codes:
activityLayout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/activity"
android:orientation="vertical">
<FrameLayout android:id="#+id/fragment_to_replace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:orientation="vertical"
android:layout_gravity="center" >
<TextView android:id="#+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:text="#string/textView_select_table"
android:textSize="30dp"/>
<ListView android:layout_marginTop="20dp"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:id="#+id/listView"
android:visibility="visible"
android:paddingTop="40dp" />
</FrameLayout>
</LinearLayout>
Activity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
View view = findViewById(R.id.activity);
//Getting the ListView
ListView listView = (ListView) view.findViewById(R.id.listView);
listView.setTextFilterEnabled(true);
//Setting the adapter
listView.setAdapter(new Adapter(this));
listView.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
//Creates a fragment
addFragment();
}
});
}
public void addFragment(){
MyFragment newFragment;
FragmentTransaction newFragmentTransaction = getSupportFragmentManager().beginTransaction();
newFragment = (MyFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment);
if (newFragment == null){
newFragment = new MyFragment(this, getSupportFragmentManager());
newFragmentTransaction.replace(R.id.fragment_to_replace,
new SelectDrinkFragment(this, getSupportFragmentManager()));
newFragmentTransaction.addToBackStack(null);
newFragmentTransaction.commit();
}
}
fragmentLayout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:text="#string/textView_two"
android:textSize="20dp"/>
<LinearLayout android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:text="#string/textView" />
<TextView android:id="#+id/textView_two"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"/>
</LinearLayout>
<TextView
android:id="#+id/textView_three"
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:text="#string/textView_three"/>
<ListView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/listView_two"
android:visibility="visible"
android:paddingTop="40dp" />
</LinearLayout>
Fragment.java
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle saveInstanceState){
View view = inflater.inflate(R.layout.fragment, container, false);
final ListView listView = (ListView) view.findViewById(R.id.listView_two);
CharSequence [] list = getResources().getStringArray(R.array.array);
listView.setAdapter(new ListAdapter(getContext(), list));
return view;
}
ListAdapter.java
public class ListAdapter extends BaseAdapter{
private Context context;
private CharSequence[] drinkArraySize;
public ListAdapter(Context context, CharSequence[] array){
super();
this.context = context;
this.array= array;
}
#Override
public int getCount() {
return array.length;
}
#Override
public Object getItem(int position) {
return null;
}
#Override
public long getItemId(int position) {
return 0;
}
public Context getContext(){
return context;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout linearLayout = new LinearLayout(getContext());
RadioButton radioButton = new RadioButton(getContext());
radioButton.setText(array[position]);
linearLayout.addView(radioButton);
return linearLayout;
}
}
FragmentTransaction.replace() looks like it only replaces another fragment (and not just any View), so I'm pretty sure this is expected behavior (or at least, I know I've had this happen to me before). I suppose you have a few options:
I don't see in your code anything that would make the fragment's background opaque. You could try that first and see if it helps. If it does, that might be the simplest.
You could just set the other items' visibilities to View.GONE at the same time you perform your transaction, but that has some issues as far as backstack goes.
You could replace the ListView and TextView with a ListFragment instead. This is probably the "best" way to do it, but also is probably the most work.