emanuelx Posted March 24, 2014 Report Share Posted March 24, 2014 boas, estou a tentar fazer uma actionbar modificada, mas estou a ter um problema com a interface, Supostamente não devia ter esses espaços entre as imagens(ImageView). Alguem sabe como é que eu posso meter o customView a ocupar a area toda, e sem espaços entre as imagens? <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#f2f2f2" android:orientation="horizontal" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/search" /> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@drawable/navegacao" /> <ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/imageView2" android:src="@drawable/bolas" /> </RelativeLayout> ActionBar actionBar = getSupportActionBar(); LayoutInflater li = LayoutInflater.from(this); View customView = li.inflate(R.layout.actionbar_styled, null); actionBar.setCustomView(customView); com calma e sem stresses Link to comment Share on other sites More sharing options...
coxosclassic Posted March 30, 2014 Report Share Posted March 30, 2014 (edited) Boas, nao sei se ja conseguiste resolver ou nao, mas estive a testar o teu codigo, e pareceu-me tudo ok. Confirma que as tuas imagens nao teem elas proprias esse espacamento (ou margens). Outra alternativa poderia ser usares antes um FrameLayout em vez de RelativeLayout, algo tipo: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#f2f2f2" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:src="@drawable/image1" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:orientation="horizontal" > <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image2" /> <ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image3" /> </LinearLayout> </FrameLayout> O uso de RelativeLayouts apesar de ser bastante poderoso, é tambem bastante pesado. O resultado que pretendes pode ser igualmente alcancado usando apenas um FrameLayout com um LinearLayout (que sao os layouts mais leves em Android), e as respetivas imagens. Espero que ajude, cc Edited March 31, 2014 by coxosclassic Cumps, cc Link to comment Share on other sites More sharing options...
emanuelx Posted April 1, 2014 Author Report Share Posted April 1, 2014 já resolvi de outra forma, desactivei a actionbar e usei várias imageview num framelayout. 1 Report com calma e sem stresses Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now