Reputation: 15744
Here is code first:
<LinearLayout
android:id="@+id/llReviewView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#d8d9d9"
android:orientation="vertical" >
<LinearLayout
android:id="@id/header"
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="#fff"
android:clickable="false"
android:baselineAligned="false"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/bWiki"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="90"
android:background="@drawable/wiki_selector"
android:contentDescription="Wiki Link"
android:src="@drawable/ic_info_wiki" />
<LinearLayout
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#666" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/spinner_bg_selector"
android:orientation="vertical" >
<Spinner
android:id="@+id/spinnerSort"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@drawable/spinnerselector" />
</LinearLayout>
</LinearLayout>
// edited
</LinearLayout>
wiki_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Pressed -->
<item android:drawable="@drawable/row_press" android:state_pressed="true"/>
<!-- Normal -->
<item android:drawable="@drawable/wiki_normal" android:state_pressed="false"/>
</selector>
Here is image of the view:
Here are the problems:
Upvotes: 0
Views: 86
Reputation: 19484
The "i" button will only respond when tapped within its bounding rectangle. I think, since you have width=0dp, it's getting set to its minimum width.
You need to decide what proportions you want the spinner vs the "i" button to occupy. Also, I'm not sure what purpose you have in mind for the two LinearLayouts. If it's already showing everything you want, you don't then the LinearLayouts.
Now, let's say you want the spinner to occupy only the width needed for its contents. Then, you should set its width as WRAP_CONTENT. For the spinner you would choose MATCH_PARENT and (I'm not sure of this) add layout_weight="1".
Alternatively, if you want the "i" button to occupy 2/3 of the width and the spinner 1/3, you need width for both to be "0dp" and the "i" button should have layout_weight="2", the spinner "1".
Upvotes: 1