android - HorizontalScrollView difficulties -


this question has answer here:

i made horizontalscrollview , inside linearlyout , in linear layout put other layouts different layout_weight , problem doesnt weight correct ,i set weightsum 3 ,but fills wrap_content

http://postimg.org/image/ds4lstkyt/

<horizontalscrollview             android:id="@+id/horizontal_scroll_view"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:background="#ffffff"             >              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:orientation="horizontal"                 android:weightsum="3"                 >                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <linearlayout                         android:layout_width="match_parent"                         android:layout_height="match_parent"                         android:orientation="vertical">                          <textview                             android:layout_width="match_parent"                             android:layout_height="wrap_content"                             android:gravity="center"                             android:text="android"                             android:textsize="12sp" />                     </linearlayout>                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                      android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="ios" />                  </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="windows\nphone" />                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="blackberry" />                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="budget\nphones" />                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="tablets" />                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="jewelry &amp;\nwatch" />                   </linearlayout>                  <view                     android:layout_width="1dp"                     android:layout_height="match_parent"                     android:layout_gravity="center_vertical"                     android:layout_marginbottom="20dp"                     android:background="#d9d9d9" />                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center"                     android:orientation="vertical"                     android:paddingleft="15dp"                     android:paddingright="15dp"                     android:paddingtop="15dp">                      <imageview                         android:layout_width="45dp"                         android:layout_height="45dp"                         android:paddingbottom="20dp"                         android:src="@drawable/ic_launcher" />                      <textview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:gravity="center"                         android:text="health &amp;\nbeauty" />                 </linearlayout>               </linearlayout>         </horizontalscrollview> 

any advises , ideas ??

you have use android:fillviewport="true" in horizontalscrollview , fill screen because scrollview ignore layout weight.

i hope you!!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -